Comparing version 1.3.2 to 1.3.3
"use strict"; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
privateMap.set(receiver, value); | ||
return value; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (kind === "m") throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to get private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _left, _right; | ||
var _BiMap_left, _BiMap_right; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class BiMap { | ||
constructor(iterable) { | ||
_left.set(this, void 0); | ||
_right.set(this, void 0); | ||
__classPrivateFieldSet(this, _left, new Map()); | ||
__classPrivateFieldSet(this, _right, new Map()); | ||
_BiMap_left.set(this, void 0); | ||
_BiMap_right.set(this, void 0); | ||
__classPrivateFieldSet(this, _BiMap_left, new Map(), "f"); | ||
__classPrivateFieldSet(this, _BiMap_right, new Map(), "f"); | ||
if (iterable === undefined) { | ||
@@ -27,36 +25,36 @@ return; | ||
for (const [k, v] of iterable) { | ||
__classPrivateFieldGet(this, _left).set(k, v); | ||
__classPrivateFieldGet(this, _right).set(v, k); | ||
__classPrivateFieldGet(this, _BiMap_left, "f").set(k, v); | ||
__classPrivateFieldGet(this, _BiMap_right, "f").set(v, k); | ||
} | ||
} | ||
clear() { | ||
__classPrivateFieldGet(this, _left).clear(); | ||
__classPrivateFieldGet(this, _right).clear(); | ||
__classPrivateFieldGet(this, _BiMap_left, "f").clear(); | ||
__classPrivateFieldGet(this, _BiMap_right, "f").clear(); | ||
} | ||
delete(key) { | ||
const val = __classPrivateFieldGet(this, _left).get(key); | ||
if (!__classPrivateFieldGet(this, _right).has(val)) { | ||
const val = __classPrivateFieldGet(this, _BiMap_left, "f").get(key); | ||
if (!__classPrivateFieldGet(this, _BiMap_right, "f").has(val)) { | ||
return false; | ||
} | ||
__classPrivateFieldGet(this, _right).delete(val); | ||
return __classPrivateFieldGet(this, _left).delete(key); | ||
__classPrivateFieldGet(this, _BiMap_right, "f").delete(val); | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").delete(key); | ||
} | ||
entries() { | ||
return __classPrivateFieldGet(this, _left).entries(); | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").entries(); | ||
} | ||
forEach(callbackfn, thisArg) { | ||
__classPrivateFieldGet(this, _left).forEach(callbackfn, thisArg); | ||
__classPrivateFieldGet(this, _BiMap_left, "f").forEach(callbackfn, thisArg); | ||
} | ||
get(key) { | ||
return __classPrivateFieldGet(this, _left).get(key); | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").get(key); | ||
} | ||
has(key) { | ||
return __classPrivateFieldGet(this, _left).has(key); | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").has(key); | ||
} | ||
keys() { | ||
return __classPrivateFieldGet(this, _left).keys(); | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").keys(); | ||
} | ||
set(key, value) { | ||
const left = __classPrivateFieldGet(this, _left); | ||
const right = __classPrivateFieldGet(this, _right); | ||
const left = __classPrivateFieldGet(this, _BiMap_left, "f"); | ||
const right = __classPrivateFieldGet(this, _BiMap_right, "f"); | ||
const oldVal = left.get(key); | ||
@@ -75,26 +73,26 @@ const oldKey = right.get(value); | ||
get size() { | ||
return __classPrivateFieldGet(this, _left).size; | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").size; | ||
} | ||
values() { | ||
return __classPrivateFieldGet(this, _left).values(); | ||
return __classPrivateFieldGet(this, _BiMap_left, "f").values(); | ||
} | ||
[(_left = new WeakMap(), _right = new WeakMap(), Symbol.iterator)]() { | ||
return __classPrivateFieldGet(this, _left)[Symbol.iterator](); | ||
[(_BiMap_left = new WeakMap(), _BiMap_right = new WeakMap(), Symbol.iterator)]() { | ||
return __classPrivateFieldGet(this, _BiMap_left, "f")[Symbol.iterator](); | ||
} | ||
get [Symbol.toStringTag]() { | ||
return __classPrivateFieldGet(this, _left)[Symbol.toStringTag]; | ||
return __classPrivateFieldGet(this, _BiMap_left, "f")[Symbol.toStringTag]; | ||
} | ||
deleteValue(value) { | ||
const key = __classPrivateFieldGet(this, _right).get(value); | ||
if (!__classPrivateFieldGet(this, _left).has(key)) { | ||
const key = __classPrivateFieldGet(this, _BiMap_right, "f").get(value); | ||
if (!__classPrivateFieldGet(this, _BiMap_left, "f").has(key)) { | ||
return false; | ||
} | ||
__classPrivateFieldGet(this, _left).delete(key); | ||
return __classPrivateFieldGet(this, _right).delete(value); | ||
__classPrivateFieldGet(this, _BiMap_left, "f").delete(key); | ||
return __classPrivateFieldGet(this, _BiMap_right, "f").delete(value); | ||
} | ||
getKey(value) { | ||
return __classPrivateFieldGet(this, _right).get(value); | ||
return __classPrivateFieldGet(this, _BiMap_right, "f").get(value); | ||
} | ||
hasValue(value) { | ||
return __classPrivateFieldGet(this, _right).has(value); | ||
return __classPrivateFieldGet(this, _BiMap_right, "f").has(value); | ||
} | ||
@@ -101,0 +99,0 @@ } |
"use strict"; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
privateMap.set(receiver, value); | ||
return value; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (kind === "m") throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to get private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _left, _right; | ||
var _WeakBiMap_left, _WeakBiMap_right; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class WeakBiMap { | ||
constructor(iterable) { | ||
_left.set(this, void 0); | ||
_right.set(this, void 0); | ||
__classPrivateFieldSet(this, _left, new WeakMap()); | ||
__classPrivateFieldSet(this, _right, new WeakMap()); | ||
_WeakBiMap_left.set(this, void 0); | ||
_WeakBiMap_right.set(this, void 0); | ||
__classPrivateFieldSet(this, _WeakBiMap_left, new WeakMap(), "f"); | ||
__classPrivateFieldSet(this, _WeakBiMap_right, new WeakMap(), "f"); | ||
if (iterable === undefined) { | ||
@@ -27,23 +25,23 @@ return; | ||
for (const [k, v] of iterable) { | ||
__classPrivateFieldGet(this, _left).set(k, v); | ||
__classPrivateFieldGet(this, _right).set(v, k); | ||
__classPrivateFieldGet(this, _WeakBiMap_left, "f").set(k, v); | ||
__classPrivateFieldGet(this, _WeakBiMap_right, "f").set(v, k); | ||
} | ||
} | ||
delete(key) { | ||
const val = __classPrivateFieldGet(this, _left).get(key); | ||
if (!__classPrivateFieldGet(this, _right).has(val)) { | ||
const val = __classPrivateFieldGet(this, _WeakBiMap_left, "f").get(key); | ||
if (!__classPrivateFieldGet(this, _WeakBiMap_right, "f").has(val)) { | ||
return false; | ||
} | ||
__classPrivateFieldGet(this, _right).delete(val); | ||
return __classPrivateFieldGet(this, _left).delete(key); | ||
__classPrivateFieldGet(this, _WeakBiMap_right, "f").delete(val); | ||
return __classPrivateFieldGet(this, _WeakBiMap_left, "f").delete(key); | ||
} | ||
get(key) { | ||
return __classPrivateFieldGet(this, _left).get(key); | ||
return __classPrivateFieldGet(this, _WeakBiMap_left, "f").get(key); | ||
} | ||
has(key) { | ||
return __classPrivateFieldGet(this, _left).has(key); | ||
return __classPrivateFieldGet(this, _WeakBiMap_left, "f").has(key); | ||
} | ||
set(key, value) { | ||
const left = __classPrivateFieldGet(this, _left); | ||
const right = __classPrivateFieldGet(this, _right); | ||
const left = __classPrivateFieldGet(this, _WeakBiMap_left, "f"); | ||
const right = __classPrivateFieldGet(this, _WeakBiMap_right, "f"); | ||
const oldVal = left.get(key); | ||
@@ -61,18 +59,18 @@ const oldKey = right.get(value); | ||
} | ||
get [(_left = new WeakMap(), _right = new WeakMap(), Symbol.toStringTag)]() { | ||
return __classPrivateFieldGet(this, _left)[Symbol.toStringTag]; | ||
get [(_WeakBiMap_left = new WeakMap(), _WeakBiMap_right = new WeakMap(), Symbol.toStringTag)]() { | ||
return __classPrivateFieldGet(this, _WeakBiMap_left, "f")[Symbol.toStringTag]; | ||
} | ||
deleteValue(value) { | ||
const key = __classPrivateFieldGet(this, _right).get(value); | ||
if (!__classPrivateFieldGet(this, _left).has(key)) { | ||
const key = __classPrivateFieldGet(this, _WeakBiMap_right, "f").get(value); | ||
if (!__classPrivateFieldGet(this, _WeakBiMap_left, "f").has(key)) { | ||
return false; | ||
} | ||
__classPrivateFieldGet(this, _left).delete(key); | ||
return __classPrivateFieldGet(this, _right).delete(value); | ||
__classPrivateFieldGet(this, _WeakBiMap_left, "f").delete(key); | ||
return __classPrivateFieldGet(this, _WeakBiMap_right, "f").delete(value); | ||
} | ||
getKey(value) { | ||
return __classPrivateFieldGet(this, _right).get(value); | ||
return __classPrivateFieldGet(this, _WeakBiMap_right, "f").get(value); | ||
} | ||
hasValue(value) { | ||
return __classPrivateFieldGet(this, _right).has(value); | ||
return __classPrivateFieldGet(this, _WeakBiMap_right, "f").has(value); | ||
} | ||
@@ -79,0 +77,0 @@ } |
{ | ||
"name": "bim", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "A bidirectional map based on the ES6 Map & WeakMap objects", | ||
@@ -27,10 +27,10 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@inker/eslint-config-typescript": "^1.1.1", | ||
"@types/jest": "^26.0.15", | ||
"eslint": "^7.13.0", | ||
"jest": "^26.6.3", | ||
"np": "^7.0.0", | ||
"ts-jest": "^26.4.3", | ||
"typescript": "^4.0.5" | ||
"@inker/eslint-config-typescript": "^10.0.1", | ||
"@types/jest": "^26.0.24", | ||
"eslint": "^7.31.0", | ||
"jest": "^27.0.6", | ||
"np": "^7.5.0", | ||
"ts-jest": "^27.0.4", | ||
"typescript": "^4.3.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
33061
723