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

syntax-db

v1.0.7

Published

A small module to query the SyntaxDB database (https://syntaxdb.com/)

Downloads

28

Readme

SyntaxDB

Build Status

This is a small wrapper module for the syntax-db REST API. You can query the site through a series of chainable commands similar to jquery:

const db = require('syntax-db')

// example of command chaining
// note that query() must be called at the end of the chain and
// actually executes the call to the server...this returns a promise
// containing the JSON parsed from the body of the response
db.categories('python')
  .limit(4)
  .sort('id')
  .query().then( data => {
     console.log(data)
}).catch( err => { throw err })

Usage

All queries end with the query() function, which actually executes the call the syntaxdb server. This function returns a promise containg the JSON received from the query (or an error if the query was invalid). So a basic request will look something like this;

db.languages().query().then( data => {
  console.log(data)
}).catch( err => { throw err })

Or, if you are using Babel and have acess to es7 features, you can use async/await:

async function getLanguages() {
  try {
    const languages = await db.languages().query()
    console.log(languages)
  } catch(err) {
    throw err 
  }
}

API

query()

Function to actually execute the query - see above for details.

categories(lang)

Get all available categories for a certain language - not that you must provide a langauge. The list of currently supported databases is shown below:

['java', 'c', 'cpp', 'csharp', 'python', 'ruby', 'javascript', 'swift', 'go']

languages(lang=null)

If no language given returns an array of language objects, if a language is provided an object containing the given language is returned.

concepts(lang=null, category_id=null)

If no parameters specified, returns all concepts for all languages. Specifying a language returns only concepts related to this language, and spefying a category id (with a language) will give a list of language-specific concepts in a given category.

search(query)

Chainable with the concepts() function. Allows you to search for a certain concept. Note that this is only valid if you are chaining with concept() or concept(lang), the API currently does not allow search through categories or langauges.

limit(limit)

Limit the number of results from the call:

db.concepts().limit(10).query().then( data => {
  console.log('data')
}).catch( err => {throw err})

fields(fields)

Specify the fields you want the API to return for the given set of objects. Function accepts an array of strings specifying the fields to include:

db.categories('python').fields(['id', 'category_name', 'category_search']).query().then( data => {
  console.log(data)
}).catch( err => { throw err })

sort(field, reverse=false)

Specify a field you want to sort the results from. You can also specify a reverse boolean, which is set to false by default.

db.categories('java').sort('id', true).query().then( data => {
  console.log('data')
}).catch( err => {throw err})

Notes

I'm not affiliated at all with syntax-db...just think it's a great site! Any contributions are welcome! :)