npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gnparser

v2.0.0

Published

Node.js wrapper for GNParser, a scientific name parser

Readme

Global Names Parser for Node.js

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

Installation

npm install gnparser

The gnparser binary is automatically downloaded from GitHub releases during installation. Downloads are verified against pinned SHA-256 hashes and cached to avoid repeated downloads.

Environment variables

| Variable | Description | |----------|-------------| | GNPARSER_SKIP_DOWNLOAD=1 | Skip binary download during install (useful if providing your own binary) | | GNPARSER_BINARY_PATH | Use a custom path to the gnparser binary | | GNPARSER_USE_SYSTEM=1 | Use system-installed gnparser from PATH instead of downloading |

Cache location

Downloaded archives are cached to avoid repeated downloads in CI:

  • macOS: ~/Library/Caches/gnparser/
  • Linux: ~/.cache/gnparser/ (or $XDG_CACHE_HOME/gnparser/)
  • Windows: %LOCALAPPDATA%\gnparser\cache\

Supported platforms

  • macOS (Intel x64 and Apple Silicon ARM64)
  • Linux (x64 and ARM64)
  • Windows (x64 and ARM64)

Usage

The package supports both ESM and CommonJS imports:

// ESM
import { parse, parseSync } from 'gnparser'

// CommonJS
const { parse, parseSync } = require('gnparser')

TypeScript

Full TypeScript support with exported types:

import { parse, parseSync, ParseOptions, ParsedName } from 'gnparser'

const result: ParsedName = await parse('Homo sapiens')

parse(names, options?): Promise

Parses scientific names asynchronously.

  • names may be an individual scientific name string or an array of name strings
  • options is an optional object with these keys:
    • details: boolean - include additional details (e.g. the individual parsed words of the name). Default is false.
    • cultivars: boolean - parse using the cultivar nomenclatural code. Default is false.
    • diaereses: boolean - preserve diaereses (e.g. Leptochloöpsis virgata) in normalized and canonical names. Default is false: diaereses will be transliterated to ASCII.
    • removeDiaereses: boolean - transliterate diaereses to their ASCII counterparts without changing the spelling, e.g. Leptochloöpsis virgataLeptochloopsis virgata

Returns a Promise that resolves to:

  • A JavaScript object for a single name input
  • An array of JavaScript objects for an array input

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

Example

import { parse } from 'gnparser'

// Parse a single name
const parsed = await parse('Pardosa moesta Banks, 1892')
console.log(parsed.canonical.simple) // "Pardosa moesta"

// Parse multiple names
const names = ['Pardosa moesta Banks, 1892', 'Parus major L.', "Anthurium 'Ace of Spades'"]
const results = await parse(names)

// With options
const result = await parse("Sarracenia flava 'Maxima'", { details: true, cultivars: true })

parseSync(names, options?)

Synchronous version of parse(). Same arguments and return values, but blocks until parsing is complete.

import { parseSync } from 'gnparser'

const parsed = parseSync('Homo sapiens Linnaeus, 1758')
console.log(parsed.canonical.simple) // "Homo sapiens"

Output structure

Each parsed name returns an object with these fields:

interface ParsedName {
  id: string                    // Deterministic UUID v5
  verbatim: string              // Original input
  parsed: boolean               // Whether parsing succeeded
  quality: number               // 1-4, lower is better
  normalized?: string           // Normalized form
  canonical?: {
    stemmed: string             // Stemmed form for matching
    simple: string              // Simple canonical name
    full: string                // Full canonical with ranks
  }
  cardinality?: number          // 1=uninomial, 2=binomial, etc.
  rank?: string                 // Taxonomic rank
  authorship?: {
    verbatim: string
    normalized: string
    year?: string
    authors?: string[]
  }
  details?: object              // Detailed parsing info (with details option)
  words?: Word[]                // Parsed words (with details option)
  parserVersion: string
}

Migration from v1.x

Version 2.0 switches from C bindings to the gnparser binary with streaming mode. Key changes:

  1. Async by default: parse() now returns a Promise. Use await or .then().
  2. Sync alternative: Use parseSync() for synchronous parsing (same behavior as v1.x parse()).
  3. No compilation required: No more node-gyp or native dependencies.
  4. Broader platform support: Now supports Windows and more architectures.
  5. ESM and CommonJS: Now supports both module systems with full TypeScript types.
// v1.x (synchronous)
const result = gnparser.parse('Homo sapiens')

// v2.x (async)
const result = await gnparser.parse('Homo sapiens')

// v2.x (sync alternative)
const result = gnparser.parseSync('Homo sapiens')

Development

Building

npm run build        # Build ESM and CJS
npm run clean        # Remove dist/
npm test             # Build and run tests

Updating gnparser version

When updating to a new gnparser version:

  1. Update GNPARSER_VERSION in src/install.ts
  2. Run npm run update-hashes to calculate and update SHA-256 hashes
  3. Run npm test to verify everything works

The preversion script automatically runs hash updates and tests before version bumps.

Versioning

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

License

MIT