New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oid

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oid - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

26

lib/oid.js

@@ -45,4 +45,12 @@ // Copyright 2012 The Obvious Corporation.

var items = {}; // map from hash to array of objects/values
var count = 0;
/**
* Get the number of elements in the set.
*/
function size() {
return count;
}
/**
* Return true if there the given value is in the set or false if not.

@@ -86,2 +94,3 @@ */

candidates.push(value);
count++;
return true;

@@ -105,2 +114,3 @@ }

candidates.splice(i, 1);
count--;
return true;

@@ -130,3 +140,4 @@ }

has: has,
remove: remove
remove: remove,
size: size
};

@@ -140,4 +151,12 @@ }

var mappings = {}; // map from hash to array of {key, value} bindings.
var count = 0;
/**
* Get the number of elements in the map.
*/
function size() {
return count;
}
/**
* Get the value associated with the given key. If there is

@@ -188,2 +207,3 @@ * no mapping for the key, return the ifNotFound argument (which

candidates.push({ key: key, value: value });
count++;
return ifNotFound;

@@ -219,2 +239,3 @@ }

candidates.splice(i, 1);
count--;
return result;

@@ -249,3 +270,4 @@ }

remove: remove,
set: set
set: set,
size: size
};

@@ -252,0 +274,0 @@ }

2

package.json
{
"name": "oid",
"version": "0.4.4",
"version": "0.4.5",
"keywords":

@@ -5,0 +5,0 @@ ["object", "id", "identity", "hash", "hashcode", "objid", "oid"],

@@ -174,2 +174,6 @@ oid

### idmap.size()
Get the number of elements in the map.
### idmap.forEach(callback)

@@ -208,2 +212,6 @@

### idset.size()
Get the number of elements in the set.
### idset.forEach(callback)

@@ -210,0 +218,0 @@

@@ -81,2 +81,3 @@ // Copyright 2012 The Obvious Corporation.

assert.equal(map.has([]), false);
assert.equal(map.size(), 0);

@@ -86,2 +87,3 @@ assert.equal(map.set("foo", "bar"), undefined);

assert.equal(map.has("foo"), true);
assert.equal(map.size(), 1);

@@ -93,2 +95,3 @@ assert.equal(map.set(1, "zorch", "xyz"), "xyz");

assert.equal(map.get(1), "spaz");
assert.equal(map.size(), 2);

@@ -101,2 +104,3 @@ var x = {};

assert.equal(map.has({}), false);
assert.equal(map.size(), 3);
assert.equal(map.remove({}), undefined);

@@ -107,2 +111,3 @@ assert.equal(map.has(x), true);

assert.equal(map.has(x), false);
assert.equal(map.size(), 2);

@@ -129,2 +134,3 @@ map.set(undefined, "hi");

assert.equal(set.has(true), false);
assert.equal(set.size(), 0);

@@ -134,5 +140,8 @@ assert.equal(set.add("x"), true);

assert.equal(set.has("x"), true);
assert.equal(set.size(), 1);
assert.equal(set.remove("x"), true);
assert.equal(set.size(), 0);
assert.equal(set.remove("x"), false);
assert.equal(set.has("x"), false);
assert.equal(set.size(), 0);

@@ -139,0 +148,0 @@ assert.equal(set.add(undefined), true);

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