当前位置: 软件>JavaScript软件
Nodejs 验证器 revalidator
本文导语: revalidator 是一款跨浏览器的 Node.js 验证器,是 resourceful 和 flatiron 正在使用的验证器。 示例 revalidator 的核心是很简单和简洁的: revalidator.validate(obj, schema): var revalidator = require('revalidator'); console.dir(revalidator.validate(someObje...
revalidator 是一款跨浏览器的 Node.js 验证器,是 resourceful 和 flatiron 正在使用的验证器。
示例revalidator 的核心是很简单和简洁的: revalidator.validate(obj, schema):
var revalidator = require('revalidator');
console.dir(revalidator.validate(someObject, {
properties: {
url: {
description: 'the url the object should be stored at',
type: 'string',
pattern: '^/[^#%&*{}\:?/+]+$',
required: true
},
challenge: {
description: 'a means of protecting data (insufficient for production, used as example)',
type: 'string',
minLength: 5
},
body: {
description: 'what to store at the url',
type: 'any',
default: null
}
}
}));
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。