UNPKG

motion

Version:

motion - moving development forward

78 lines (77 loc) 3.73 kB
{ "_args": [ [ "stringmap@~0.2.2", "/Users/nw/motion/packages/motion/node_modules/defs" ] ], "_from": "stringmap@>=0.2.2 <0.3.0", "_id": "stringmap@0.2.2", "_inCache": true, "_installable": true, "_location": "/stringmap", "_npmUser": { "email": "olov.lassus@gmail.com", "name": "olov" }, "_npmVersion": "1.2.18", "_phantomChildren": {}, "_requested": { "name": "stringmap", "raw": "stringmap@~0.2.2", "rawSpec": "~0.2.2", "scope": null, "spec": ">=0.2.2 <0.3.0", "type": "range" }, "_requiredBy": [ "/defs" ], "_resolved": "https://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz", "_shasum": "556c137b258f942b8776f5b2ef582aa069d7d1b1", "_shrinkwrap": null, "_spec": "stringmap@~0.2.2", "_where": "/Users/nw/motion/packages/motion/node_modules/defs", "author": { "email": "olov.lassus@gmail.com", "name": "Olov Lassus" }, "bugs": { "url": "https://github.com/olov/stringmap/issues" }, "dependencies": {}, "description": "fast and robust stringmap", "devDependencies": {}, "directories": {}, "dist": { "shasum": "556c137b258f942b8776f5b2ef582aa069d7d1b1", "tarball": "http://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz" }, "homepage": "https://github.com/olov/stringmap#readme", "keywords": [ "__proto__", "dict", "dictionary", "hash", "hashmap", "stringmap" ], "license": "MIT", "main": "stringmap.js", "maintainers": [ { "name": "olov", "email": "olov.lassus@gmail.com" } ], "name": "stringmap", "optionalDependencies": {}, "readme": "# stringmap.js\nA fast and robust stringmap implementation that can hold any string keys,\nincluding `__proto__`, with minimal overhead compared to a plain object.\nWorks in node and browsers.\n\nThe API is created to be as close to the ES6 Map API as possible. Prefer\n`sm.remove(\"key\")` for deleting a key. ES6 Map uses `map.delete(\"key\")`\ninstead and for that reason `sm['delete'](\"key\")` is available as a\nstringmap alias as well. Never do `sm.delete(\"key\")` unless you're\ncertain to be in the land of ES5 or later.\n\n\n\n## Examples\nAvailable in `examples.js`\n\n```javascript\nvar StringMap = require(\"stringmap\");\n\nvar sm1 = new StringMap();\nsm1.set(\"greeting\", \"yoyoma\");\nsm1.set(\"check\", true);\nsm1.set(\"__proto__\", -1);\nconsole.log(sm1.has(\"greeting\")); // true\nconsole.log(sm1.get(\"__proto__\")); // -1\nsm1.remove(\"greeting\");\nconsole.log(sm1.keys()); // [ 'check', '__proto__' ]\nconsole.log(sm1.values()); // [ true, -1 ]\nconsole.log(sm1.items()); // [ [ 'check', true ], [ '__proto__', -1 ] ]\nconsole.log(sm1.toString()); // {\"check\":true,\"__proto__\":-1}\n\nvar sm2 = new StringMap({\n one: 1,\n two: 2,\n});\nconsole.log(sm2.map(function(value, key) {\n return value * value;\n})); // [ 1, 4 ]\nsm2.forEach(function(value, key) {\n // ...\n});\nconsole.log(sm2.isEmpty()); // false\nconsole.log(sm2.size()); // 2\n\nvar sm3 = sm1.clone();\nsm3.merge(sm2);\nsm3.setMany({\n a: {},\n b: [],\n});\nconsole.log(sm3.toString()); // {\"check\":true,\"one\":1,\"two\":2,\"a\":{},\"b\":[],\"__proto__\":-1}\n```\n\n\n\n## Installation\n\n### Node\nInstall using npm\n\n npm install stringmap\n\n```javascript\nvar StringMap = require(\"stringmap\");\n```\n\n### Browser\nClone the repo and include it in a script tag\n\n git clone https://github.com/olov/stringmap.git\n\n```html\n<script src=\"stringmap/stringmap.js\"></script>\n```\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/olov/stringmap.git" }, "scripts": {}, "version": "0.2.2" }