
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
安装方法: npm install utils2 -S
const Validator = require('utils2/lib/validator');
const validator = new Validator({
rules: {
id: 'required|int'
}
});
const input = validator.filter(req.body);
try {
validator.check(input);
} catch(err) {
// 错误处理
//res.validateError(err);
//next(err);
}
工具库:基本IO操作的封装;validator是对表单输入的数据进行过滤和验证的封装;仿lodash方法的封装(有些写法不习惯,所以自己造轮子)
基本对象的方法拓展(string/number/date等,风险有点大.有次改了object的原型造成sequelize报错)
初始化仓库
添加了validator对输入进行验证和过滤.用mocha进行单元测试
validator添加filter()方法
尝试assert的strictEqual测试
没设计好
1.new rule
2.filter
3.check (包含解析和断言)
1.对基础对象的拓展都放到_.js中
2.修改validator抛出错误的方式
3.发布到npm
FAQs
validator,_,IO,string,date,numer,array
We found that utils2 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.