【文件属性】:
文件名称:json-spec:JSON Spec是用于验证和生成JSON数据的工具
文件大小:579KB
文件格式:ZIP
更新时间:2021-05-05 03:51:54
json json-generator json-validation JavaScript
JSON规范
JSON Spec是用于验证和生成JSON数据的工具。 这是clojure.spec的一部分的移植。
证实
规格定义如下
const s = require ( '@json-spec/core' ) ;
const bigEven = s . and ( x => ! isNaN ( Number ( x ) ) , x => x % 2 === 0 , x => x > 1000 ) ;
您可以使用规格进行验证
s . isValid ( bigEven , 'foo' ) ; // false
s . isValid ( bigEven , 10 ) ; // false
s . isValid ( bigEven , 10000 ) ; // true
验证JSON对象的示例如下。
const isString = x => typeof ( x ) === '
【文件预览】:
json-spec-master
----.gitignore(939B)
----package.json(761B)
----package-lock.json(395KB)
----LICENSE(14KB)
----lerna.json(350B)
----examples()
--------tutorial()
----README.md(2KB)
----lib()
--------core()
--------jest-matcher()
--------openapi()
--------testcheck()
----specs()
--------profiles()
--------range()
--------basic()
----project.clj(232B)