Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
api-checker
Advanced tools
根据自定义的模板数据结构来检测后端数据接口返回的数据是否满足前端要求.
对于必要属性发生缺失,直接报错;对于非必要属性,可以通过模板数据赋值合并,且可以设置默认值
In a browser:
<script src="api-checker.js"></script>
Using npm:
$ npm i -S api-checker / yarn add api-checker
key1: '', // 字符串类型
key2: 0, // 数字类型
key3: true, // 布尔类型
...
key: {
v: '', // 这里可以设置任意简单数据类型的初始值
required: true
}
key: {
v: [...],
required: true
}
or
key: {
v: {..},
required: true
}
被设置为必要属性的字段发生缺失或类型错误,直接抛出错误,所以凡是前端可以用默认值替代的字段尽量不建议设置为必要字段。其次,接口数据如果在模板数据中为出现,直接过滤掉。
数据模板结构:
apiChecker.check(tplData, apiData, {
showLog: true,
success: function (data) {
console.log(data)
},
error: function (err) {
console.log(err)
},
warn: function (curVal, oldItem, newItem) {
// console.log('warn!')
}
})
FAQs
check api data
The npm package api-checker receives a total of 2 weekly downloads. As such, api-checker popularity was classified as not popular.
We found that api-checker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.