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

referencejs

v0.4.0

Published

Easily create, update, and manipulate references to values in a JSON document.

Readme

Referencejs Build Status

Referencejs manages references to values in plain JS or Immutable objects (called stores). You can use this to:

  1. Easily manage complex denormalized, without needing an explicited schema
  2. referencing data that doesn't exist yet (e.g. async data)
  3. normalize and denormalize immutable data
  4. Lazily denormalize stored data

Getting Started

Update a Plain store

import { createReference, resolveReference, dereference } from 'referencejs';
const jon = {
  id: 'user_1',
  name: 'John Doe',
  email: '[email protected]'
};
const jonRefrence = createReference('auth', 'users', jon.id);

let store = {};
store = resolveReference(store, jonReference, jon);

dereference(store, jonRefrence) === jon;

Or use Immutable if that's your jam

import { Map, is } from 'immutable';
import { createReference, resolveReference, dereference } from 'referencejs/immutable';
const jon = Map({
  id: 'user_1',
  name: 'John Doe',
  email: '[email protected]'
});
const jonRefrence = createReference('auth', 'users', jon.id);

let store = Map();
store = resolveReference(store, jonReference, jon);

is(dereference(store, jonRefrence), jon);

More Advanced: smartDereference

Dereferencing one reference at a time can be painful. smartDereference scans an object or array and dereferences every reference it finds

import {
  createReference,
  smartDereference,
} from 'referencejs';

const store = {
  users: {
    user1: {
      name: 'John Doe'
    },
    user2: {
      name: 'Jane Doe'
    },
    user3: {
      name: 'Billy Doe'
    },

    user4: {
      name: 'Lucy Doe'
    }
  }
};

const john = createReference(['users', 'user1']);
const jane = createReference(['users', 'user2']);
const billy = createReference(['users', 'user3']);
const lucy = createReference(['users', 'user4']);

const familyTreeReferences = {
  father: john,
  mother: jane,
  children: [billy, lucy]
};

// familyTree will contain the user objects instead of the references  
const familyTree = smartDereference(store, familyTree);

Like what you see?