# immutable-schema

> Schema validator for immutable js structures

Latest version **0.5.2** (published 2016-03-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install immutable-schema
pnpm add immutable-schema
yarn add immutable-schema
bun add immutable-schema
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2016-03-14 |
| First published | 2015-09-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | duckpunch |

## Links

- npm: https://www.npmjs.com/package/immutable-schema
- Repository: https://github.com/duckpunch/immutable-js-schema
- Issues: https://github.com/duckpunch/immutable-js-schema/issues
- npm.io page: https://npm.io/package/immutable-schema

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.5.1
- [immutable](https://npm.io/package/immutable.md) ^3.7.5

## Recent versions

- 0.5.2 (latest) — 2016-03-14
- 0.5.1 — 2016-03-14
- 0.5.0 — 2016-03-13
- 0.4.0 — 2016-03-13
- 0.3.0 — 2016-02-29
- 0.2.1 — 2015-09-29
- 0.1.3 — 2015-09-28
- 0.1.2 — 2015-09-27
- 0.1.1 — 2015-09-27
- 0.1.0 — 2015-09-27

## README

# immutable-js-schema

[![npm](https://img.shields.io/npm/v/immutable-schema.svg)](https://www.npmjs.com/package/immutable-schema)
[![Build Status](https://travis-ci.org/duckpunch/immutable-js-schema.svg)](https://travis-ci.org/duckpunch/immutable-js-schema)
[![Document](http://duckpunch.github.io/immutable-js-schema/badge.svg)](http://duckpunch.github.io/immutable-js-schema/)
[![Dependencies](https://david-dm.org/duckpunch/immutable-js-schema.svg)](https://david-dm.org/duckpunch/immutable-js-schema)

Schema validator for [immutable-js](http://facebook.github.io/immutable-js/) structures

## Getting Started

`npm install immutable-schema`

Then,

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

## Examples

```javascript
const schema = FixedListSchema(isString, isNumber, Exactly('greetings'));
const list = List.of('hi', 14.5, 'greetings');
assert.ok(schema(list));
```

```javascript
const schema = MapSchema(
    isString, isNumber,
    v => isNumber(v) && (v % 2 === 0), isString
);

assert.ok(schema(
    Map().set('hi', 5).set(14, 'roar')
));
```

---
_Source: https://npm.io/package/immutable-schema · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
