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

ds.js

v0.0.0

Published

Javascript data structures to store primitive and complex Javascript objects

Readme

===== ds.js

Javascript data structures to store primitive and complex Javascript objects. Every library file is an implementation of a data structure.

Browsers and Node.js support

It supports the following browsers:

  • Chrome 19+
  • Firefox 4+
  • Safari 5+
  • IE9+

It's also available for these Node.js versions:

  • 0.8.0+

Quick start

Four quick start options are available:

  • Download the latest release
  • Clone the repo: git clone https://github.com/evonove/ds.js.git
  • Install via bower (browser): bower install ds.js
  • Install via npm (node.js): npm install ds.js

Available data structures

Hashmap


``hashmap.min.js``: 400 Bytes (gzip)

Features
  • works like a traditional hashmap (get and put)
  • Javascript primitives can be used as a key
  • Arrays and Javascript Objects can be used as a key
  • DOM elements can be used as a key
  • AMD module support

Browser configuration


Just add this *before* of all ``<script>`` tags where do you want to use ``ds.js``:

.. code-block:: html

    <!-- Latest compiled and minified JavaScript -->
    <script src="bower_components/ds.js/dist/hashmap.min.js"></script>

You're done! It now exposes a constructor in your global namespace: ``window.Ds.HashMap``.

Node.js configuration

Just require this library in your code:

.. code-block:: javascript

var Ds = require('node_modules/ds.js/dist/hashmap.min.js').Ds

You're done! Now you can use Ds.HashMap constructor.

Usage


In your code simply create and access your new hashmap:

.. code-block:: javascript

    // Create useful objects
    var object = { description: 'This is a plain javascript object' };
    var myMap = new Ds.HashMap();                   // Create a new hashmap

    myMap.put(object, ['mapped', 'array']);         // Add element to hashmap
    var item = myMap.get(object);                   // Get element from hashmap
    assert.deepEqual(item, ['mapped', 'array']);    // true

You can even use DOM elements as a keys:

.. code-block:: javascript

    // Create useful objects
    var newDiv = document.createElement("div");
    var newContent = document.createTextNode("Hi there and greetings!");
    newDiv.appendChild(newContent);

    myMap.put(newDiv, { statement: 'this is my model instance' });
    var item = myMap.get(newDiv);
    assert.deepEqual(item, { statement: 'this is my model instance' });      // true

License
-------

BSD-2 license. See ``LICENSE`` for more details.