schematics:用于 Javascript 的声明性数据结构验证器

时间:2021-07-07 10:46:13
【文件属性】:
文件名称:schematics:用于 Javascript 的声明性数据结构验证器
文件大小:13KB
文件格式:ZIP
更新时间:2021-07-07 10:46:13
JavaScript 示意图 Javascript 的声明性数据结构验证。 下载/安装 下载 通过 NPM npm install schematics : npm install schematics 通过 Bower bower install schematics : bower install schematics 概述 在 JavaScript 中验证数据通常是一个乏味的过程,涉及大量条件检查并导致函数难以阅读且具有高圈复杂度。 schematics旨在通过提供一个接口来缓解这种情况,该接口允许您以声明方式描述您的数据结构,然后根据它检查您的数据。 每个验证步骤都可以返回一个承诺,因此可以集成与数据库或类似异步过程的检查。 目前用于承诺。 一个简单的例子: var s = require ( "schematics" ) ; // declare a schema for objects
【文件预览】:
schematics-master
----index.js(46B)
----package.json(692B)
----test()
--------test-nil.js(641B)
--------test-obj.js(984B)
--------test-arr.js(1KB)
--------test-or.js(507B)
--------test-date.js(866B)
--------test-num.js(1KB)
--------test-msg.js(594B)
--------test-str.js(1KB)
--------test-bool.js(737B)
--------common.js(1KB)
----LICENSE(1KB)
----Gruntfile.js(584B)
----.gitignore(44B)
----lib()
--------schematics.js(9KB)
----README.md(6KB)
----.jshintrc(447B)
----bower.json(445B)
----.editorconfig(202B)

网友评论