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

@ncbijs/litvar

v0.1.1

Published

LitVar2 API client — find literature linked to genetic variants by rsID

Readme

@ncbijs/litvar

Runtime: Browser + Node.js

Typed client for the LitVar2 API. Find literature linked to genetic variants and retrieve publication IDs mentioning specific rsIDs.

Installation

pnpm install @ncbijs/litvar

Usage

import { LitVar } from '@ncbijs/litvar';

const litvar = new LitVar();

const info = await litvar.variant('rs328');
console.log(`${info.gene.join(', ')}: ${info.name}`);

const pubs = await litvar.publications('rs328');
console.log(`${pubs.count} publications, first PMID: ${pubs.pmids[0]}`);

API

new LitVar(config?)

| Option | Default | Description | | ------------ | ------- | ----------------------------------- | | maxRetries | 3 | Number of retries on 429/5xx errors |

variant(rsid: string): Promise<LitVarVariant>

Get variant information by rsID. Returns gene associations, HGVS notation, and clinical significance.

publications(rsid: string): Promise<LitVarPublicationResult>

Get publication IDs (PMIDs and PMCIDs) associated with a variant by rsID.

search(query: string): Promise<ReadonlyArray<LitVarSearchResult>>

Search LitVar for variants matching a text query (gene name, rsID prefix, HGVS notation, etc.).

Bulk parsing

parseLitVarJson(json: string): ReadonlyArray<LitVarVariant>

Parses a LitVar2 bulk variant file. Accepts either a JSON array or NDJSON format (e.g. litvar2_variants.json.gz after decompression).

import { parseLitVarJson } from '@ncbijs/litvar';
const variants = parseLitVarJson(fs.readFileSync('litvar2_variants.json', 'utf-8'));

Error handling

import { LitVar, LitVarHttpError } from '@ncbijs/litvar';

const litvar = new LitVar();

try {
  await litvar.variant('rs000000000');
} catch (err) {
  if (err instanceof LitVarHttpError) {
    console.error(`HTTP ${err.status}: ${err.body}`);
  }
}

Response types

LitVarVariant

interface LitVarVariant {
  rsid: string;
  gene: ReadonlyArray<string>;
  name: string;
  hgvs: string;
  clinicalSignificance: ReadonlyArray<string>;
}

LitVarPublicationResult

interface LitVarPublicationResult {
  pmids: ReadonlyArray<number>;
  pmcids: ReadonlyArray<string>;
  count: number;
}

LitVarSearchResult

interface LitVarSearchResult {
  rsid: string;
  gene: ReadonlyArray<string>;
  name: string;
  hgvs: string;
  publicationCount: number;
  clinicalSignificance: ReadonlyArray<string>;
  match: string;
}