Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
normalize-json
Advanced tools
Terse syntax for validating and normalizing JavaScript objects in Node.
const nJ = require('normalize-json');
// a schema looks like this!
let validator = nJ({
name: [String, 30], // a string with <= 30 characters
age: [Number, 0, 100], // a number between 0 and 100, inclusive
color: ['red', 'yellow', 'blue'] // must be one of these three values
});
// here's how we might validate/normalize an object
let obj = {
name: ' Nigel ', // this string will be trimmed!
age: 23,
color: 'blue',
someUndefinedField: undefined // undefined fields will be stripped out
};
let result = validator(obj); // 'result' is a new object; 'obj' has not been changed
console.log(result); // { name: 'Nigel', age: 23, color: 'blue' }
You can try out normalize-json in your browser at npm.runkit.com/normalize-json.
TODO
FAQs
Terse syntax for validating and normalizing JavaScript objects
We found that normalize-json 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.