Comparing version 0.0.3 to 0.0.4
38
index.js
"use strict"; | ||
var BiMap = (function () { | ||
function BiMap(iterable) { | ||
var Bim = (function () { | ||
function Bim(iterable) { | ||
this.left = new Map(iterable); | ||
@@ -8,7 +8,7 @@ this.right = new Map(); | ||
} | ||
BiMap.prototype.clear = function () { | ||
Bim.prototype.clear = function () { | ||
this.left.clear(); | ||
this.right.clear(); | ||
}; | ||
BiMap.prototype.delete = function (key) { | ||
Bim.prototype.delete = function (key) { | ||
var val = this.left.get(key); | ||
@@ -21,18 +21,18 @@ if (!this.right.has(val)) { | ||
}; | ||
BiMap.prototype.entries = function () { | ||
Bim.prototype.entries = function () { | ||
return this.left.entries(); | ||
}; | ||
BiMap.prototype.forEach = function (callbackfn, thisArg) { | ||
Bim.prototype.forEach = function (callbackfn, thisArg) { | ||
this.left.forEach(callbackfn, thisArg); | ||
}; | ||
BiMap.prototype.get = function (key) { | ||
Bim.prototype.get = function (key) { | ||
return this.left.get(key); | ||
}; | ||
BiMap.prototype.has = function (key) { | ||
Bim.prototype.has = function (key) { | ||
return this.left.has(key); | ||
}; | ||
BiMap.prototype.keys = function () { | ||
Bim.prototype.keys = function () { | ||
return this.left.keys(); | ||
}; | ||
BiMap.prototype.set = function (key, value) { | ||
Bim.prototype.set = function (key, value) { | ||
var oldVal = this.left.get(key); | ||
@@ -50,3 +50,3 @@ var oldKey = this.right.get(value); | ||
}; | ||
Object.defineProperty(BiMap.prototype, "size", { | ||
Object.defineProperty(Bim.prototype, "size", { | ||
get: function () { | ||
@@ -58,9 +58,9 @@ return this.left.size; | ||
}); | ||
BiMap.prototype.values = function () { | ||
Bim.prototype.values = function () { | ||
return this.left.values(); | ||
}; | ||
BiMap.prototype[Symbol.iterator] = function () { | ||
Bim.prototype[Symbol.iterator] = function () { | ||
return this.left[Symbol.iterator](); | ||
}; | ||
Object.defineProperty(BiMap.prototype, Symbol.toStringTag, { | ||
Object.defineProperty(Bim.prototype, Symbol.toStringTag, { | ||
get: function () { | ||
@@ -72,3 +72,3 @@ return this.left[Symbol.toStringTag]; | ||
}); | ||
BiMap.prototype.deleteValue = function (value) { | ||
Bim.prototype.deleteValue = function (value) { | ||
var key = this.right.get(value); | ||
@@ -81,10 +81,10 @@ if (!this.left.has(key)) { | ||
}; | ||
BiMap.prototype.getKey = function (value) { | ||
Bim.prototype.getKey = function (value) { | ||
return this.right.get(value); | ||
}; | ||
BiMap.prototype.hasValue = function (value) { | ||
Bim.prototype.hasValue = function (value) { | ||
return this.right.has(value); | ||
}; | ||
return BiMap; | ||
return Bim; | ||
}()); | ||
exports.BiMap = BiMap; | ||
module.exports = Bim; |
{ | ||
"name": "bim", | ||
"version": "0.0.3", | ||
"description": "foo", | ||
"version": "0.0.4", | ||
"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.", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
/// <reference path="../typings/tsd.d.ts" />; | ||
export class BiMap<K, V> implements Map<K, V> { | ||
export default class Bim<K, V> implements Map<K, V> { | ||
private left: Map<K, V>; | ||
@@ -4,0 +4,0 @@ private right: Map<V, K>; |
@@ -1,4 +0,4 @@ | ||
import { BiMap } from '../src/bimap'; | ||
import Bim from '../src/bimap'; | ||
const m = new BiMap<string, number>(); | ||
const m = new Bim<string, number>(); | ||
m.set("foo", 3); | ||
@@ -5,0 +5,0 @@ m.set("bar", 12); |
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
918312
20