1.0.0 • Published 9 years ago

observ-enum v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

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