Comparing version 2.0.1 to 2.0.2
@@ -59,5 +59,3 @@ "use strict"; | ||
for (var member in map) { | ||
if (this._options.name && ["name", "_options", "get", "getKey", "getValue", "enums", "isFlaggable"].includes(member)) { | ||
throw new Error("Enum key \"" + member + "\" is a reserved word!"); | ||
} | ||
guardReservedKeys(this._options.name, member); | ||
this[member] = new EnumItem(member, map[member], { ignoreCase: this._options.ignoreCase }); | ||
@@ -282,2 +280,12 @@ this.enums.push(this[member]); | ||
module.exports = Enum; | ||
module.exports = Enum; | ||
// private | ||
var reservedKeys = ["_options", "get", "getKey", "getValue", "enums", "isFlaggable"]; | ||
function guardReservedKeys(customName, key) { | ||
if (customName && key === "name" || indexOf.call(reservedKeys, key) >= 0) { | ||
throw new Error("Enum key " + key + " is a reserved word!"); | ||
} | ||
} |
{ | ||
"author": "adrai", | ||
"name": "enum", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -24,4 +24,4 @@ # Introduction | ||
|:------------|:----------------|:---------| | ||
| `enum-2.0.1.js` | *uncompressed, with comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.0.1.js) | | ||
| `enum-2.0.1.min.js` | *compressed, without comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.0.1.min.js) | | ||
| `enum-2.0.2.js` | *uncompressed, with comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.0.2.js) | | ||
| `enum-2.0.2.min.js` | *compressed, without comments* | [Download](https://raw.github.com/adrai/enum/master/enum-2.0.2.min.js) | | ||
@@ -28,0 +28,0 @@ # Installation (node.js) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20386
332
0