Socket
Socket
Sign inDemoInstall

stringmap

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stringmap - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

examples.js

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

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