# object-schema-validation

> Simple object schema description and validation

Latest version **1.1.1** (published 2016-08-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install object-schema-validation
pnpm add object-schema-validation
yarn add object-schema-validation
bun add object-schema-validation
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2016-08-16 |
| First published | 2016-08-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Alexander Marenin |
| Maintainers | ioncreature |
| Keywords | simple, object, schema, validate, validation, mongoose |

## Links

- npm: https://www.npmjs.com/package/object-schema-validation
- Repository: https://github.com/ioncreature/simple-object-schema
- Homepage: https://github.com/ioncreature/simple-object-schema#readme
- Issues: https://github.com/ioncreature/simple-object-schema/issues
- npm.io page: https://npm.io/package/object-schema-validation

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2016-08-16
- 1.1.0 — 2016-08-16
- 1.0.2 — 2016-08-11
- 1.0.1 — 2016-08-04
- 1.0.0 — 2016-08-03

## README

# object-schema-validation

Simple object schema description and validation


Simple Usage
============

```js

const Schema = require( 'object-schema-validation' );

var someSchema = new Schema({
        name: String, 
        age: Number
    }),
    validation = someSchema.validate({
        name: 'Johny', 
        age: 88
    });

if ( validation.valid )
    console.log( 'yay, its valid' );
else
    console.warn( 'oh, no! It invalid', validation.error );

```

Available types
===============

```js
    
    var userSchema = new Schema({
        age: Number,
        name: String,
        birthDate: Date,
        about: {type: String, max: 100500, required: true},
        friends: [Number],
        posts: [{text: String, at: Date}],
        weight: {type: Number, min: 30, max: 300, required: true},
        meta: {
            la: Number,
            lalala: {type: Date},
            blabla: {
                list: [String],
                isTrue: Boolean
            }
        },
        complicated: function( val ){
            return Math.random() * 2 | 0;
        }
    })
        
    userSchema.validate( user ); // returns {valid: Boolean, error?: Error}

```

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