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

graphcommons

v0.1.6

Published

Node JS Wrapper For Graph Commons API

Readme

Node.js Wrapper For Graph Commons API.

More detailed API documentation:

http://graphcommons.github.io/api-v1/

Installation

npm install graphcommons

Usage


 > var gc = require('graphcommons');
 > var accesskey = process.env.YOURENVIRONMENTACCESSKEYWHICHYOUSHOULDNOTSTOREINYOURCODE;

 > var callback = function(result) {
	console.log('log:', result);
 }

 > var graphcommons = new gc(accesskey, callback);
 
 log: { msg: 'Working' }

Graph Object

Get graph


> var callback = function(graph) {
    console.log('log:', graph);
    console.log('edges: ', graph.edges);
    console.log('nodes: ', graph.nodes);

    //All the other properties of the graph can be retrieved from
    console.log(grpah.properties);
 }

> graphcommons.graphs(graph_id,callback);

Graph Utility Functions


> graph.get_node(node_id)
> returns a matching node from graph
> 
> graph.edges_for(node,'to'));
> graph.edges_for(node,'from'));
> returns edges to or from
> 
> graph.edges_from(node) short for graph.edges_for(node,'from'))
> graph.edges_to(node) shor for graph.edges_for(node,'to'));

Get node


> var callback = function(node) {
    console.log('log:', node);

 }

> graphcommons.nodes(node_id,callback);

Update Graph


var signals = { "signals" : [
                    {
                      "action": "node_create",
                      "type": "NodeType",
                      "name": "NodeName",
                      "description": "test description",
                      "properties": {
                            "prop1": "one",
                            "prop2": 2
                        }
                    }
                ]
            };

> var callback = function(graph) {
    console.log('log:', graph);
    console.log('edges: ', graph.edges);
    console.log('nodes: ', graph.nodes);
 }

> graphcommons.update_graph('f71116ba-cf77-4703-826a-daac2ab2f085',signals,callback);

Search Nodes

// query  query to be searched
// hub  id of the hub to search in
// graph  id of the graph to search in
// status status of the nodes to return.
// Available values:
// 0 => published
// 1 => work in progress
// 2 => private
// public => published and work in progress
// limit  limit the number of results (max: 20)
// skip number of results to skip
var node_search_query = {
  'query' : 'test',
  'graph' : 'f71116ba-cf77-4703-826a-daac2ab2f085' 
}
var searchresults = function(results) {
  console.log(results)
}

graphcommons.nodes_search(search_query,searchresults);

Search Graph Commons

//query query to be searched
//limit limit the number of results (max: 20)
//skip  number of results to skip
var search_query = {
  'query' : 'energy'
}
var searchresults = function(results) {
  console.log(results)
}

graphcommons.search(search_query,searchresults);

###TODO

  • [x] Graph Utility Functions
  • [ ] Add Mocha for tests
  • [ ] Better wrapper for Signals?