Home

Awesome

Global Names Parser for Node.js

This module provides Node.js bindings for GNParser by the Global Names Project.

Installation

npm install gnparser

Supported architectures

The module currently supports MacOS (ARM64 only) and Linux.

Usage

parse(names: string | array, options?: object)

The recommended options for parsing botanical names are { cultivars: true, diaereses: true }.

For example:

const gnparser = require("gnparser")
const name = "Pardosa moesta Banks, 1892"
const parsed = gnparser.parse(name)

parsed will be a JavaScript object derived from the JSON output of GNParser.

You may also pass multiple names which will be parsed as a batch:

const names = ["Pardosa moesta Banks, 1892", "Parus major L.", "Anthurium 'Ace of Spades'"]
const parsed = gnparser.parse(names)

Here, parsed will be an array of JavaScript objects.

const gnparser = require("gnparser")
const name = "Sarracenia flava 'Maxima'"
const parsed = gnparser.parse(name, { details: true, cultivars: true })

The cultivar name will be included in the normalized and canonical names, and the most detailed output from GNParser will be included.

Versioning

This module's major and minor version number matches that of the main GNParser Go project, but the patch version differs.