
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
api-compare
Advanced tools
:yum: Optional comparator, compare multiple request results, highlight the diff.
:yum: Optional comparator, compare multiple request results, highlight the diff.
由一次项目代码优化而产生的轮子,用于 diff 数个接口之间的返回值是否一致。
自定义一些对比规则,来帮助验证确保升级不会影响到原有的数据结构。
npm i -D api-compare
const Comparator = require('api-compare')
async function main() {
let c = new Comparator()
c.append({
urlList: [
'https://postman-echo.com/get?name=Niko&age=18',
'https://postman-echo.com/get?name=Bellic&age=18'
],
validator(data) {
data.login = 'Login must be equal'
data.site_admin = 'Site_admin must be equal'
}
})
console.log('start check')
let results = await c.check()
console.log('get results', results[0])
// [ { msg: 'Login must be equal', validate: true }, { msg: 'Age must be equal', validate: false } ]
}
main()
| key | type | desc |
|---|---|---|
| errorOnly? | Boolean | Filter access log |
let c = new Comparator({
errorOnly: true
})
Add new request group.
| key | type | desc |
|---|---|---|
| urlList | Array | List of request |
| validator | Function | Custom validate |
| optionList? | Array/Object | Request option, like method, headers |
c.append({
urlList: [
'domain1',
'domain2'
],
validator(data) {
// do some validate
}
})
c.append().append()
If optionList less than urlList, recycle optionList like padStart/padEnd.
c.append({
urlList: [
'domain1', 'domain2',
'domain3', 'domain4'
],
optionList: [{
option: 1
}, {
option: 2
}]
})
// domain1 {option: 1}
// domain2 {option: 2}
// domain3 {option: 1}
// domain4 {option: 2}
Run all task from append.
Return results, order of append.
let results = await c.check() // results for validate
FAQs
:yum: Optional comparator, compare multiple request results, highlight the diff.
We found that api-compare 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.