Comparing version 0.2.0 to 0.2.1
@@ -9,3 +9,3 @@ var StringSet = require("./stringset"); | ||
console.log(ss1.has("__proto__")); // true | ||
ss1.delete("greeting"); | ||
ss1.remove("greeting"); | ||
console.log(ss1.items()); // [ 'check', '__proto__' ] | ||
@@ -12,0 +12,0 @@ console.log(ss1.toString()); // {"check","__proto__"} |
{ | ||
"name": "stringset", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "fast and robust stringset", | ||
@@ -5,0 +5,0 @@ "main": "stringset.js", |
@@ -6,4 +6,10 @@ # stringset.js | ||
The API is created to be as close to the ES6 Set API as possible. Prefer | ||
`ss.remove("key")` for deleting a key. ES6 Set uses `set.delete("key")` | ||
instead and for that reason `ss['delete']("key")` is available as a | ||
stringset alias as well. Never do `ss.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(ss1.has("__proto__")); // true | ||
ss1.delete("greeting"); | ||
ss1.remove("greeting"); | ||
console.log(ss1.items()); // [ 'check', '__proto__' ] | ||
@@ -24,0 +30,0 @@ console.log(ss1.toString()); // {"check","__proto__"} |
@@ -99,3 +99,3 @@ // stringset.js | ||
stringset.prototype['delete'] = function(item) { | ||
stringset.prototype.remove = function(item) { | ||
if (typeof item !== "string") { | ||
@@ -113,2 +113,8 @@ throw new Error("StringSet expected string item"); | ||
// alias remove to delete but beware: | ||
// ss.delete("key"); // OK in ES5 and later | ||
// ss['delete']("key"); // OK in all ES versions | ||
// ss.remove("key"); // OK in all ES versions | ||
stringset.prototype['delete'] = stringset.prototype.remove; | ||
stringset.prototype.isEmpty = function() { | ||
@@ -115,0 +121,0 @@ for (var item 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
9378
175
61