immutable-schema

0.5.2 • Public • Published

immutable-js-schema

npm Build Status Document Dependencies

Schema validator for immutable-js structures

Getting Started

npm install immutable-schema

Then,

import {
    ListSchema, FixedListSchema, MapSchema, Exactly, OneOf
} from 'immutable-schema';

Examples

const schema = FixedListSchema(isString, isNumber, Exactly('greetings'));
const list = List.of('hi', 14.5, 'greetings');
assert.ok(schema(list));
const schema = MapSchema(
    isString, isNumber,
    v => isNumber(v) && (% 2 === 0), isString
);
 
assert.ok(schema(
    Map().set('hi', 5).set(14, 'roar')
));

Readme

Keywords

none

Package Sidebar

Install

npm i immutable-schema

Weekly Downloads

10

Version

0.5.2

License

ISC

Last publish

Collaborators

  • duckpunch