observ-enum

1.0.0 • Public • Published

observ-enum Build Status

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

Package Sidebar

Install

npm i observ-enum

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker