Skip to content

Instantly share code, notes, and snippets.

View peshkov3's full-sized avatar

Peshkov Maxim peshkov3

  • Finverity
  • UK
View GitHub Profile
@peshkov3
peshkov3 / validator.js
Last active April 17, 2018 10:34
nodejs-validator
import * as changeCase from 'change-case';
// Laravel's like node js request data validator
// Usage:
//
// let v = new Validator(body, {
// index: 'required|string',
// lang: 'string',
// code: 'required|number',
// phone_number: 'required|string|regex:/^\\+?[1-9]\\d{1,14}$/',