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

bim

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bim - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

build/increment-version.js

34

lib/bim.js

@@ -37,12 +37,13 @@ "use strict";

BiMap.prototype.set = function (key, value) {
var oldVal = this.left.get(key);
var oldKey = this.right.get(value);
if (this.left.has(key)) {
this.right.delete(oldVal);
var _a = this, left = _a.left, right = _a.right;
var oldVal = left.get(key);
var oldKey = right.get(value);
if (left.has(key)) {
right.delete(oldVal);
}
if (this.right.has(value)) {
this.left.delete(oldKey);
if (right.has(value)) {
left.delete(oldKey);
}
this.left.set(key, value);
this.right.set(value, key);
left.set(key, value);
right.set(value, key);
return this;

@@ -118,12 +119,13 @@ };

WeakBiMap.prototype.set = function (key, value) {
var oldVal = this.left.get(key);
var oldKey = this.right.get(value);
if (this.left.has(key)) {
this.right.delete(oldVal);
var _a = this, left = _a.left, right = _a.right;
var oldVal = left.get(key);
var oldKey = right.get(value);
if (left.has(key)) {
right.delete(oldVal);
}
if (this.right.has(value)) {
this.left.delete(oldKey);
if (right.has(value)) {
left.delete(oldKey);
}
this.left.set(key, value);
this.right.set(value, key);
left.set(key, value);
right.set(value, key);
return this;

@@ -130,0 +132,0 @@ };

{
"name": "bim",
"version": "1.0.4",
"version": "1.0.5",
"description": "A bidirectional map based on the ES6 Map object containing additional methods to retrive keys by values, delete key-value pairs by values and check the existence of keys by values.",

@@ -27,2 +27,2 @@ "main": "index.js",

}
}
}

@@ -46,12 +46,13 @@ export class BiMap<K, V> implements Map<K, V> {

set(key: K, value: V): this {
const oldVal = this.left.get(key)
const oldKey = this.right.get(value)
if (this.left.has(key)) {
this.right.delete(oldVal)
const { left, right } = this
const oldVal = left.get(key)
const oldKey = right.get(value)
if (left.has(key)) {
right.delete(oldVal)
}
if (this.right.has(value)) {
this.left.delete(oldKey)
if (right.has(value)) {
left.delete(oldKey)
}
this.left.set(key, value)
this.right.set(value, key)
left.set(key, value)
right.set(value, key)
return this

@@ -132,12 +133,13 @@ }

set(key: K, value: V): this {
const oldVal = this.left.get(key)
const oldKey = this.right.get(value)
if (this.left.has(key)) {
this.right.delete(oldVal)
const { left, right } = this
const oldVal = left.get(key)
const oldKey = right.get(value)
if (left.has(key)) {
right.delete(oldVal)
}
if (this.right.has(value)) {
this.left.delete(oldKey)
if (right.has(value)) {
left.delete(oldKey)
}
this.left.set(key, value)
this.right.set(value, key)
left.set(key, value)
right.set(value, key)
return this

@@ -144,0 +146,0 @@ }

@@ -6,3 +6,3 @@ {

"sourceMap": false,
"watch": true,
// "watch": true,
"pretty": true,

@@ -9,0 +9,0 @@ "lib": [ "dom", "es7" ],

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