Comparing version 0.2.1 to 0.2.2
@@ -9,3 +9,3 @@ var StringMap = require("./stringmap"); | ||
console.log(sm1.get("__proto__")); // -1 | ||
sm1.delete("greeting"); | ||
sm1.remove("greeting"); | ||
console.log(sm1.keys()); // [ 'check', '__proto__' ] | ||
@@ -12,0 +12,0 @@ console.log(sm1.values()); // [ true, -1 ] |
{ | ||
"name": "stringmap", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "fast and robust stringmap", | ||
@@ -5,0 +5,0 @@ "main": "stringmap.js", |
@@ -6,4 +6,10 @@ # stringmap.js | ||
The API is created to be as close to the ES6 Map API as possible. Prefer | ||
`sm.remove("key")` for deleting a key. ES6 Map uses `map.delete("key")` | ||
instead and for that reason `sm['delete']("key")` is available as a | ||
stringmap alias as well. Never do `sm.delete("key")` unless you're | ||
certain to be in the land of ES5 or later. | ||
## Examples | ||
@@ -21,3 +27,3 @@ Available in `examples.js` | ||
console.log(sm1.get("__proto__")); // -1 | ||
sm1.delete("greeting"); | ||
sm1.remove("greeting"); | ||
console.log(sm1.keys()); // [ 'check', '__proto__' ] | ||
@@ -24,0 +30,0 @@ console.log(sm1.values()); // [ true, -1 ] |
@@ -109,3 +109,3 @@ // stringmap.js | ||
stringmap.prototype['delete'] = function(key) { | ||
stringmap.prototype.remove = function(key) { | ||
if (typeof key !== "string") { | ||
@@ -124,2 +124,8 @@ throw new Error("StringMap expected string key"); | ||
// alias remove to delete but beware: | ||
// sm.delete("key"); // OK in ES5 and later | ||
// sm['delete']("key"); // OK in all ES versions | ||
// sm.remove("key"); // OK in all ES versions | ||
stringmap.prototype['delete'] = stringmap.prototype.remove; | ||
stringmap.prototype.isEmpty = function() { | ||
@@ -126,0 +132,0 @@ for (var key in this.obj) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12062
248
75