Skip to content
simple javascript StringMap class
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist
src
test
.gitignore
.npmignore
Gruntfile.js source code in es6
README.md
bower.json
package.json

README.md

StringMap

simple javascript StringMap class.

Installation

nodejs

npm install string-map --save

browser (dev - min)

<script src="path/to/string-map.js"></script>

Usage

// nodejs
// var StringMap = require('string-map');

var map = new StringMap();

map.set('one', 1);
map.set('two', 2);

// or
map.set({
  one: 1,
  two: 2
});

map.get('one'); // => 1

map.exists('one'); // => true

map.keys(); // => ["one", "two"]

map.remove("two"); // => true (when removed)

map.remove("two"); // => false (already removed)

var formatted = true;
var ident = '\t'
var json1 = map.toString(formatted, ident); // returns a json string formatted
var json2 = map.toString(false); // returns a json string NOT formatted

License

MIT

Something went wrong with that request. Please try again.