Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.