enumerated-type
Advanced tools
Comparing version 0.5.12 to 0.5.14
@@ -249,2 +249,5 @@ 'use strict'; | ||
value: function (key, defaultValue = UNDEFINED) { | ||
// allow values to be passed | ||
if (this.values.indexOf(key) !== -1) return key; | ||
return forEach.call(enumValues, (enumValue) => { | ||
@@ -251,0 +254,0 @@ if (enumValue[keyName] === key) return BREAK(enumValue); |
{ | ||
"name": "enumerated-type", | ||
"version": "0.5.12", | ||
"version": "0.5.14", | ||
"description": "enum type for javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,3 +21,3 @@ # enumerated-type | ||
Use `new Enum(enumName, values, commonProperties, keyPropName, labelPropertyName)` to define an | ||
Use `new Enum(enumName, values, commonProperties, keyPropName, labelPropName)` to define an | ||
enum for given values. The property values of the `values` object can be | ||
@@ -135,5 +135,5 @@ objects/arrays/functions or non-objects. | ||
non-object values. | ||
* `dropdownChoices` : an array of `{value: xxx, label: yyy}` where `xxx` is the `keyPropertyName` | ||
value and `yyy` is the `labelPropertyName` value from the enum `values` used during | ||
construction. If `labelPropertyName` is not given then the name of the property will be used. | ||
* `dropdownChoices` : an array of `{value: xxx, label: yyy}` where `xxx` is the `keyPropName` | ||
value and `yyy` is the `labelPropName` value from the enum `values` used during | ||
construction. If `labelPropName` is not given then the name of the property will be used. | ||
* `.keys` : array of enum key properties if keyPropName was passed to constructor, otherwise | ||
@@ -140,0 +140,0 @@ array of enum values which were not objects |
@@ -5,2 +5,3 @@ # Version History | ||
- [0.5.14](#0514) | ||
- [0.5.12](#0512) | ||
@@ -19,2 +20,7 @@ - [0.5.8](#058) | ||
## 0.5.14 | ||
* Fix: allow enum values to be passed to `value()` or `keyPropName()` functions since these are | ||
valid enums. | ||
## 0.5.12 | ||
@@ -21,0 +27,0 @@ |
22994
275