Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bmi3-schema-validator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bmi3-schema-validator

Simple validation library for bmi3 interpreter

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

bmi3-schema-validator

Простой валидатор объектов по схемам похожим на схемы Mongoose, но независимо от него. Изначально использовался для конструктора ботов Botmother

Быстрый старт

const Validator = require('bmi3-schema-validator');
const validator = new Validator({
  title: {
    required: true,
    type: String
  },
  description: String,
  tags: [{ name: { type: String, required: true }, description: String }],
  client: {
    name: {
      required: true,
      type: String
    },
    age: Number,
    gender: {
      type: String,
      enum: ['male', 'female']
    }
  }
});

const result = validator.validateSync({
  title: 'Бот для заказа ботов',
  description: 'Еще один бот',
  tags: [],
  client: {
    name: 'Петров',
    gender: 'male'
  }
});
if (!result) console.info('Все ок!');
else {
  console.error('У нас проблемы:');
  for (const err of result) {
    console.error(err);
  }
}

Лицензия

MIT. Никакие гарантии на библиотеку не распространяются, она предоставляется как есть.

FAQs

Package last updated on 17 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc