string-dict

1.0.0 • Public • Published

string-dict

A dictionary prototype for JavaScript using strings as keys. It avoids common JS object pitfalls and adds some convenience methods known from JS arrays.

Usage

var Dict = require("string-dict");

var myDict = new Dict({
    "weather": "good",
    "mood": "splendid",
    "wants": "food",
    "warts": 3
});

myDict.set("hasOwnProperty", "foo");
myDict.has("hasOwnProperty"); // true
myDict.get("hasOwnProperty"); // "foo"

myDict.forEach(console.log.bind(console));
myDict.keys(); // ["weather", "mood", "wants", "warts", "hasOwnProperty"]

Package Sidebar

Install

npm i string-dict

Weekly Downloads

0

Version

1.0.0

License

BSD-3-Clause

Last publish

Collaborators

  • jsteinbeck