1.0.0 • Published 9 years ago
observ-enum v1.0.0
observ-enum
Observable value that can only accept a preset list of values
Install
$ npm install --save observ-enum
Usage
var Enum = require('observ-enum')
var Color = Enum(['red', 'green', 'blue'])
var color = Color('green')
//=> ok!
color.set('purple')
//=> throws!
API
Enum(values)
-> function
Returns an observable that behaves normally unless non-enumerated values are passed in.
values
Required
Type: array[string]
Allowed string values for the enum.
License
MIT © Ben Drucker
1.0.0
9 years ago