Comparing version 0.1.0 to 0.2.0
@@ -54,2 +54,4 @@ (function () { | ||
this.enums = []; | ||
if (map.length) { | ||
@@ -65,6 +67,7 @@ var array = map; | ||
for (var member in map) { | ||
if ((this._options.name && member === 'name') || member === '_options' || member === 'get' || member === 'getKey' || member === 'getValue') { | ||
if ((this._options.name && member === 'name') || member === '_options' || member === 'get' || member === 'getKey' || member === 'getValue' || member === 'enums') { | ||
throw new Error('Enum key "' + member + '" is a reserved word!'); | ||
} | ||
this[member] = new EnumItem(member, map[member]); | ||
this.enums.push(this[member]); | ||
} | ||
@@ -71,0 +74,0 @@ |
{ | ||
"author": "adrai", | ||
"name": "enum", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -15,4 +15,4 @@ # Introduction | ||
|:------------|:----------------|:---------| | ||
| `enum-0.1.0.js` | *uncompressed, with comments* | [Download](https://raw.github.com/adrai/enum/master/enum-0.1.0.js) | | ||
| `enum-0.1.0.min.js` | *compressed, without comments* | [Download](https://raw.github.com/adrai/enum/master/enum-0.1.0.min.js) | | ||
| `enum-0.2.0.js` | *uncompressed, with comments* | [Download](https://raw.github.com/adrai/enum/master/enum-0.2.0.js) | | ||
| `enum-0.2.0.min.js` | *compressed, without comments* | [Download](https://raw.github.com/adrai/enum/master/enum-0.2.0.min.js) | | ||
@@ -74,2 +74,6 @@ # Installation (node.js) | ||
// get all items | ||
myEnum.enums // returns all enums in an array | ||
// compare | ||
@@ -76,0 +80,0 @@ myEnum.A.is(myEnum.A) |
@@ -20,3 +20,3 @@ var expect = expect || require('expect.js') | ||
describe('defining a simple enum', function() { | ||
describe('defining an enum', function() { | ||
@@ -53,2 +53,12 @@ var myEnum; | ||
it('get all enum values', function() { | ||
expect(myEnum.enums).to.be.an('array'); | ||
expect(myEnum.enums).to.have.length(3); | ||
expect(myEnum.enums).to.contain(myEnum.A); | ||
expect(myEnum.enums).to.contain(myEnum.B); | ||
expect(myEnum.enums).to.contain(myEnum.C); | ||
}); | ||
describe('call has', function() { | ||
@@ -55,0 +65,0 @@ |
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
26497
439
135