open-index/open-npm huggingface dataset:
npm package: @perfect-schema/base
Description: Model and schema validation done perfectly.
Author: Yanick Rochon
Latest version: 2.6.0
Deprecated: Package moved to @perfect-data/schema

# Perfect Schema
[![Build Status](https://travis-ci.org/perfect-schema/perfect-schema.svg?branch=master)](https://travis-ci.org/perfect-schema/perfect-schema)
[![Coverage Status](https://coveralls.io/repos/github/perfect-schema/perfect-schema/badge.svg?branch=master)](https://coveralls.io/github/perfect-schema/perfect-schema?branch=master)

Model and schema validation done perfectly.


## Install

```
npm i -S @perfect-schema/base
```

## Usage

```js
import PerfectSchema from '@perfect-schema/base';

const itemSchema = new PerfectSchema({
  _id: String,
  name: {
    type: String,
    required: true,
    minLength: 3
  },
  qty: {
    type: PerfectSchema.Integer,
    minInteger: 0,
    defaultValue: 0
  },
  price: Number
});

const cartItemSchema = new PerfectSchema({
  itemId: String,
  qty: Number
});

const cartSchema = new PerfectSchema({
  _id: String,
  userId: String,
  items: PerfectSchema.ArrayOf(cartItemSchema)
})

const context = cartSchema.createContext();
const item = cartSchema.createModel({
  items: [{
    name: 'foo'
  }]
});


if (!context.validate(item)) {
  // context.isValid() == false
  console.error(context.getMessages());
}
```

## Documentation

* [API reference](https://perfect-schema.github.io/perfect-schema/docs/api.html)
* [Field types](https://perfect-schema.github.io/perfect-schema/docs/types.html)
* [Plugins and extending PerfectSchema](https://perfect-schema.github.io/perfect-schema/docs/plugins.html)
* [About this project](https://perfect-schema.github.io/perfect-schema/docs/about.html)


## license

MIT
npm package: @perfect-schema/extends
Description: Extends PerfectSchema instances from other schemas.
Author: Yanick Rochon
Latest version: 1.1.4
Deprecated: Package moved to different org, see @perfect-data/schema for more information

# Perfect Schema - Extends Plugin

Extends PerfectSchema instances with other schemas.


## Install

```
npm i -S @perfect-schema/extends
```

## Usage

```js
import PerfectSchema from '@perfect-schema/base';
import extendsPlugin from '@perfect-schema/extends';


PerfectSchema.use(extendsPlugin);


const baseSchema = new PerfectSchema({
  foo: String,
  bar: Boolean
});


const schema = new PerfectSchema({
  foo: {
    type: String,
    minLength: 10,
    maxLength: 20
  }
}, {
  extends: baseSchema
});

schema.fieldNames;
// => ['foo', 'bar']
```

## Documentation

* [Perfect Schema Documentation](https://perfect-schema.github.io/perfect-schema/)


## license

MIT
npm package: @perfect-schema/standard-validators
Description: Standard validators for Perfect Schema
Author: Yanick Rochon
Latest version: 2.3.0
Deprecated: Package moved to different org, see @perfect-data/schema for more information

# Perfect Schema Standard Validatiors Plugin

Provide standard validation for schemas.


## Install

```
npm i -S @perfect-schema/standard-validators
```


## Usage

```js
import PerfectSchema from '@perfect-schema/base';
import { 
  matchValidator,
  restrictedValuesValidator
} from '@perfect-schema/standard-validators';


PerfectSchema.use(matchValidator);
PerfectSchema.use(restrictedValuesValidator);

const schema = new PerfectSchema({
  foo: {
    type: String,
    match: /[a-z0-9]+/i
  },
  bar: {
    type: Number,
    restrictedValues: [2, 3, 5, 7, 11, 13, 17, 19]
  }
});
```


## Documentation

* [Perfect Schema Documentation](https://perfect-schema.github.io/perfect-schema/)
* Standard validators
  * [Allowed Values](https://perfect-schema.github.io/standard-validators/docs/allowed-values.html)
  * [Custom validation](https://perfect-schema.github.io/standard-validators/docs/custom.html)
  * [Match Pattern](https://perfect-schema.github.io/standard-validators/docs/match.html)
  * [Restricted Values](https://perfect-schema.github.io/standard-validators/docs/restricted-values.html)


## license

MIT
npm package: @perfect-schema/tracker
Description: Extends PerfectSchema instances with other schemas.
Author: Yanick Rochon
Latest version: 1.2.0
Deprecated: Package moved to different org, see @perfect-data/schema for more information

# Perfect Schema - Tracker Plugin

Enable Tracker-enabled PerfectSchema instances.


## Install

```
npm i -S @perfect-schema/tracker
```

## Usage

```js
import PerfectSchema from '@perfect-schema/base';
import trackerPlugin from '@perfect-schema/tracker';
import { Tracker } from 'meteor/tracker';

/**
 * Manually setting Tracker to PerfectSchema
 * allows providing custom implementations and
 * prevent unnecessary dependencies
 */
PerfectSchema.Tracker = Tracker;
PerfectSchema.use(trackerPlugin);


const baseSchema = new PerfectSchema({
  foo: String
});


const schema = new PerfectSchema({
  foo: {
    type: String,
    minLength: 10,
    maxLength: 20
  }
});

const context = schema.createContext();

context.isValid();  // reactive method
```

## Documentation

* [Perfect Schema Documentation](https://perfect-schema.github.io/perfect-schema/)


## license

MIT