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 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-directededge

v0.1.0

Published

A DirectedEdge Node.js Client

Downloads

11

Readme

node-directededge

A client implementation of Directed Edge's REST API in Node.js.

What is Directed Edge?

Directed Edge (http://directededge.com) helps you find related stuff.

It's a recommendations engine that plugs into your site to deliver Amazon-like recommendations. You can show your users personalized recommendations and similar content or products based on data you're already collecting.

Installation

Installing node-directededge

  $ npm install node-directedge

Examples

Example 1

Get 5 new recommended interests for a user

  var de = new DirectedEdge('username', 'password');

  var params = {
  	excludeLinked: true,
  	maxResults: 5,
  	tags: 'interest'
  }

  de.getRecommended('user1', params, function(err, data, res) {
  	console.log(data);
  });

  // Outputs:
  // {"@":{"version":"0.1"},"item":{"@":{"id":"user1"},"count":"5",
  // "recommended":["interest2014","interest2098","interest1989","interest1932","interest1977"]}}

Example 2

Update an item

  var de = new DirectedEdge('username', 'password');

  // Params for puts are object literals with arrays, and
  // in the case of weighted_links, nested arrays
  var params = {
    links: ['interest1', 'interest2'], // Creates links
    weighted_links: [ ['interest3', 10], ['interest4', 0] ], // Creates links with weights
  	tags: ['user'] // Creates tags
  }

  de.putItem('user1', 'add', params, function(err, data, res) {
  	// Updates the item
  });

Example 3

Remove from an item

  var de = new DirectedEdge('username', 'password');

  // We'll remove the links and tags created in Example 2
  var params = {
    links: ['interest1', 'interest2'], // Creates links
    weighted_links: [ ['interest3', 10], ['interest4', 0] ], // Creates links with weights
  	tags: ['user'] // Creates tags
  }

  de.putItem('user1', 'remove', params, function(err, data, res) {
  	// Removes from the item
  });

Example 4

Overwrite an item

  var de = new DirectedEdge('username', 'password');

  // We'll remove the links and tags created in Example 2
  var params = {
    links: ['interest5', 'interest6'] // Creates links
  }

  de.putItem('user1', 'overwrite', params, function(err, data, res) {
  	// Overwrites the item by passing in the overwrite method
  });

Example 5

Delete a resource

  var de = new DirectedEdge('username', 'password');

  de.deleteItem('user1', function(err, data, res) {
    // This deletes user1 from DE
  });