Socket
Socket
Sign inDemoInstall

stringset

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stringset - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

examples.js

@@ -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) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc