@cedx/enum
Advanced tools
Comparing version 1.0.0 to 1.1.0
# Changelog | ||
This file contains highlights of what changes on each version of the [Enums for JS](https://github.com/cedx/enum.js) library. | ||
## Version 1.1.0 | ||
- Non-scalar values are excluded from the iteration of enumerable properties. | ||
## Version 1.0.0 | ||
- Initial release. |
@@ -26,3 +26,7 @@ 'use strict'; | ||
for (let prop in typeDef) enumType[prop] = typeDef[prop]; | ||
for (let prop in typeDef) { | ||
let type = typeof typeDef[prop]; | ||
if (type == 'boolean' || type == 'number' || type == 'string') enumType[prop] = typeDef[prop]; | ||
} | ||
return Object.freeze(enumType); | ||
@@ -29,0 +33,0 @@ } |
@@ -10,3 +10,3 @@ { | ||
"repository": "cedx/enum.js", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
@@ -13,0 +13,0 @@ "jsnext:main": "./src/index", |
@@ -10,3 +10,3 @@ # Enums for JS | ||
The latest [Node.js](https://nodejs.org) and [NPM](https://www.npmjs.com) versions. | ||
If you plan to play with the sources, you will also need the [Gulp.js](http://gulpjs.com/) latest version. | ||
If you plan to play with the sources, you will also need the latest [Gulp.js](http://gulpjs.com/) version. | ||
@@ -23,3 +23,3 @@ ## Installing via [npm](https://www.npmjs.com) | ||
### Create the enumeration | ||
Just use the `Enum.create()` method on an object literal: | ||
Just use the `Enum.create()` method with an object literal containing scalar values: | ||
@@ -46,6 +46,4 @@ ```javascript | ||
The created class has a constructor throwing an `Error`: it prohibits its instantiation. Thus, the obtained enumeration can only contain static members. You should only use named constants as its source values. | ||
The created class has a constructor throwing an `Error`: it prohibits its instantiation. This class is also freezed to prevent any attempt at modifying its shape. | ||
The enumeration is also freezed to prevent any attempt at modifying its shape. | ||
### Work with the enumeration | ||
@@ -52,0 +50,0 @@ Check whether a value is defined among the enumerated type: |
@@ -21,3 +21,7 @@ /** | ||
for (let prop in typeDef) enumType[prop] = typeDef[prop]; | ||
for (let prop in typeDef) { | ||
let type = typeof typeDef[prop]; | ||
if (type == 'boolean' || type == 'number' || type == 'string') enumType[prop] = typeDef[prop]; | ||
} | ||
return Object.freeze(enumType); | ||
@@ -24,0 +28,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
19838
117
78