Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multikey-map

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multikey-map - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

1

bld/index.d.ts

@@ -9,4 +9,5 @@ export declare class MultikeyMap<K extends any[], V> {

set(keys: K, value: V): void;
delete(keys: K): boolean;
private getMapValueObject(keys);
}
export default MultikeyMap;

@@ -20,3 +20,3 @@ "use strict";

return mapValue ?
['value' in mapValue, mapValue.value] :
[mapValue.valueSet, mapValue.value] :
[false, undefined];

@@ -31,11 +31,51 @@ };

if (!mapValue) {
mapValue = { map: createMap(weak) };
mapValue = {
map: undefined,
valueSet: false,
value: undefined,
};
map.set(key, mapValue);
}
if (i === keys.length - 1) {
mapValue.value = value;
if (i < keys.length - 1) {
if (mapValue.map) {
map = mapValue.map;
}
else {
map = mapValue.map = createMap(weak);
}
continue;
}
map = mapValue.map;
if (!mapValue.valueSet) {
mapValue.valueSet = true;
}
mapValue.value = value;
}
};
MultikeyMap.prototype.delete = function (keys) {
var map = this.map;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var mapValue = map.get(key);
if (!mapValue) {
return false;
}
if (i < keys.length - 1) {
if (!mapValue.map) {
return false;
}
map = mapValue.map;
continue;
}
if (mapValue.valueSet) {
mapValue.valueSet = false;
mapValue.value = undefined;
return true;
}
else {
return false;
}
}
// To pass TypeScript checking.
return false;
};
MultikeyMap.prototype.getMapValueObject = function (keys) {

@@ -49,7 +89,12 @@ var map = this.map;

}
if (i === keys.length - 1) {
return mapValue;
if (i < keys.length - 1) {
if (!mapValue.map) {
return undefined;
}
map = mapValue.map;
continue;
}
map = mapValue.map;
return mapValue;
}
// To pass TypeScript checking.
return undefined;

@@ -56,0 +101,0 @@ };

8

package.json
{
"name": "multikey-map",
"version": "0.1.1",
"version": "0.1.2",
"description": "Multikey Map",
"scripts": {
"tsc": "tsc",
"tslint": "tslint",
"build": "tsc",
"lint": "tslint --project tsconfig.json --type-check"
"lint": "tslint --project tsconfig.json --type-check",
"test": "ava bld/test"
},

@@ -17,2 +16,3 @@ "main": "bld/index.js",

"devDependencies": {
"ava": "^0.22.0",
"tslint": "^5.6.0",

@@ -19,0 +19,0 @@ "typescript": "^2.4.2",

Sorry, the diff of this file is not supported yet

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