@absolunet/joi 中文文档教程
@absolunet/joi
joi extensions + extra goodies
Install
$ npm install @absolunet/joi
Usage
import { Joi, validateArgument } from '@absolunet/joi';
class MyClass () {
constructor(path, value) {
validateArgument('path', path, Joi.absolutePath().required());
validateArgument('value', value, Joi.number().required());
// Do your stuff
}
}
Extensions
absolutePath
验证该值是绝对 *nix 或 Windows 路径。
joiSchema
验证该值是一个 joi 模式。
kebabCase
验证该值是否为 kebab-case。
variableName
通过 is-var-name 验证该值是否为 JavaScript 有效变量名。
Documentation
查看文档
License
MIT © Absolunet< /a>
@absolunet/joi
joi extensions + extra goodies
Install
$ npm install @absolunet/joi
Usage
import { Joi, validateArgument } from '@absolunet/joi';
class MyClass () {
constructor(path, value) {
validateArgument('path', path, Joi.absolutePath().required());
validateArgument('value', value, Joi.number().required());
// Do your stuff
}
}
Extensions
absolutePath
Validate that the value is an absolute *nix or Windows path.
joiSchema
Validate that the value is a joi schema.
kebabCase
Validate that the value is kebab-case.
variableName
Validate that the value is a JavaScript valid variable name via is-var-name.
Documentation
View documentation
License
MIT © Absolunet