many-keys-map
Advanced tools
Comparing version 1.0.0 to 1.0.1
25
index.js
@@ -11,2 +11,7 @@ 'use strict'; | ||
let keyCounter = 0; | ||
function checkKeys(keys) { | ||
if (!Array.isArray(keys)) { | ||
throw new TypeError('The keys parameter must be an array'); | ||
} | ||
} | ||
@@ -76,6 +81,3 @@ module.exports = class ManyKeysMap extends Map { | ||
set(keys, value) { | ||
if (!Array.isArray(keys)) { | ||
throw new TypeError('The keys parameter must be an array'); | ||
} | ||
checkKeys(keys); | ||
const {publicKey} = this[getInternalKeys](keys, true); | ||
@@ -86,6 +88,3 @@ return super.set(publicKey, value); | ||
get(keys) { | ||
if (!Array.isArray(keys)) { | ||
throw new TypeError('The keys parameter must be an array'); | ||
} | ||
checkKeys(keys); | ||
const {publicKey} = this[getInternalKeys](keys); | ||
@@ -96,6 +95,3 @@ return super.get(publicKey); | ||
has(keys) { | ||
if (!Array.isArray(keys)) { | ||
throw new TypeError('The keys parameter must be an array'); | ||
} | ||
checkKeys(keys); | ||
const {publicKey} = this[getInternalKeys](keys); | ||
@@ -106,6 +102,3 @@ return super.has(publicKey); | ||
delete(keys) { | ||
if (!Array.isArray(keys)) { | ||
throw new TypeError('The keys parameter must be an array'); | ||
} | ||
checkKeys(keys); | ||
const {publicKey, privateKey} = this[getInternalKeys](keys); | ||
@@ -112,0 +105,0 @@ return Boolean(publicKey && super.delete(publicKey) && this[publicKeys].delete(privateKey)); |
{ | ||
"name": "many-keys-map", | ||
"version": "1.0.0", | ||
"description": "", | ||
"version": "1.0.1", | ||
"description": "A `Map` subclass with support for multiple keys for one entry.", | ||
"license": "MIT", | ||
"repository": "bfred-it/many-keys-map", | ||
"author": "Federico Brigante <github@bfred.it> (bfred.it)", | ||
"keywords": [], | ||
"keywords": [ | ||
"multiple", | ||
"keys", | ||
"map", | ||
"multimap", | ||
"multi", | ||
"key", | ||
"many", | ||
"any" | ||
], | ||
"files": [ | ||
@@ -10,0 +19,0 @@ "index.js" |
7115
87
98