Comparing version 0.30.0 to 0.31.0
@@ -62,2 +62,8 @@ /** | ||
// The operands of all bitwise operators are converted to *signed* 32-bit integers. | ||
// Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers | ||
// Shifting by 31 changes the sign (i.e. 1 << 31 = -2147483648). | ||
// Therefore, get absolute value. | ||
newBytes = Math.abs(newBytes); | ||
// Updating size | ||
@@ -106,2 +112,4 @@ if (newBytes > oldBytes) | ||
newBytes = Math.abs(newBytes); | ||
// Updating size | ||
@@ -108,0 +116,0 @@ if (newBytes > oldBytes) |
@@ -78,2 +78,4 @@ /** | ||
newBytes = Math.abs(newBytes); | ||
// Updating size | ||
@@ -122,2 +124,4 @@ if (newBytes > oldBytes) | ||
newBytes = Math.abs(newBytes); | ||
// Updating size | ||
@@ -142,6 +146,6 @@ if (newBytes > oldBytes) | ||
if (typeof newCapacity !== 'number' || newCapacity < 0) | ||
throw new Error('mnemonist.dynamic-array.applyPolicy: policy returned an invalid value (expecting a positive integer).'); | ||
throw new Error('mnemonist/bit-vector.applyPolicy: policy returned an invalid value (expecting a positive integer).'); | ||
if (newCapacity <= this.capacity) | ||
throw new Error('mnemonist.dynamic-array.applyPolicy: policy returned a less or equal capacity to allocate.'); | ||
throw new Error('mnemonist/bit-vector.applyPolicy: policy returned a less or equal capacity to allocate.'); | ||
@@ -148,0 +152,0 @@ // TODO: we should probably check that the returned number is an integer |
# Changelog | ||
## 0.31.0 | ||
* Adding `DefaultMap.peek`. | ||
* Fixing some error messages. | ||
* Fixing `BitSet` & `BitVector` `#.size` caching. | ||
## 0.30.0 | ||
@@ -4,0 +10,0 @@ |
@@ -19,2 +19,3 @@ /** | ||
get(key: K): V | undefined; | ||
peek(key: K): V | undefined; | ||
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void; | ||
@@ -21,0 +22,0 @@ keys(): Iterator<K>; |
@@ -38,3 +38,3 @@ /** | ||
* Method used to get the value set for given key. If the key does not exist, | ||
* the value will be set. | ||
* the value will be created using the provided factory. | ||
* | ||
@@ -57,2 +57,13 @@ * @param {any} key - Target key. | ||
/** | ||
* Method used to get the value set for given key. If the key does not exist, | ||
* a value won't be created. | ||
* | ||
* @param {any} key - Target key. | ||
* @return {any} | ||
*/ | ||
DefaultMap.prototype.peek = function(key) { | ||
return this.items.get(key); | ||
}; | ||
/** | ||
* Method used to set a value for given key. | ||
@@ -59,0 +70,0 @@ * |
{ | ||
"name": "mnemonist", | ||
"version": "0.30.0", | ||
"version": "0.31.0", | ||
"description": "Curated collection of data structures for the JavaScript language.", | ||
@@ -75,10 +75,10 @@ "scripts": { | ||
"damerau-levenshtein": "^1.0.5", | ||
"eslint": "^6.0.1", | ||
"eslint": "^6.6.0", | ||
"leven": "^3.1.0", | ||
"lodash": "^4.17.11", | ||
"lodash": "^4.17.15", | ||
"matcha": "^0.7.0", | ||
"mocha": "^6.1.4", | ||
"mocha": "^6.2.2", | ||
"pandemonium": "^1.2.1", | ||
"seedrandom": "^3.0.1", | ||
"typescript": "^3.5.2" | ||
"seedrandom": "^3.0.5", | ||
"typescript": "^3.7.2" | ||
}, | ||
@@ -85,0 +85,0 @@ "eslintConfig": { |
@@ -40,3 +40,3 @@ /** | ||
if (arguments.length < 1) | ||
throw new Error('mnemonist/dynamic-array: expecting at least a byte array constructor.'); | ||
throw new Error('mnemonist/vector: expecting at least a byte array constructor.'); | ||
@@ -105,6 +105,6 @@ var initialCapacity = initialCapacityOrOptions || 0, | ||
if (typeof newCapacity !== 'number' || newCapacity < 0) | ||
throw new Error('mnemonist.dynamic-array.applyPolicy: policy returned an invalid value (expecting a positive integer).'); | ||
throw new Error('mnemonist/vector.applyPolicy: policy returned an invalid value (expecting a positive integer).'); | ||
if (newCapacity <= this.capacity) | ||
throw new Error('mnemonist.dynamic-array.applyPolicy: policy returned a less or equal capacity to allocate.'); | ||
throw new Error('mnemonist/vector.applyPolicy: policy returned a less or equal capacity to allocate.'); | ||
@@ -111,0 +111,0 @@ // TODO: we should probably check that the returned number is an integer |
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
317274
11417