类型验证器值类型验证器。根据模式验证对象中的类型,通过访问器公开它们。用法:


npm install --save types-validator

var types_validator = require('types-validator');

var raw_config = { ipaddress: '127.0.0.1', port: 8080, mongo: { user: 'db-user', pass: 'db-pass' } };

var schema = { 'ipaddress': String, 'port': Number, 'mongo.user': String, 'mongo.pass': String };

// validate config against schema