Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
dynamic-rules
Advanced tools
the most fun and fast way to eval javascript objects
const dynamicRules = require('dynamic-rules');
// This can be any javascript object
const myModel = {
amount: 118,
subtotal: 100,
taxes: 18,
typeDocument: {
name: 'INVOICE',
},
};
// This is the config dynamic-rules needs.
// model represents the parent of the object
const config = {
condition: 'model.typeDocument.name === "INVOICE"',
formula: '(model.subtotal * model.amount) + 10',
};
const result = dynamicRules.execute(myModel, config);
console.log(result);
/*
{
meetCondition: true,
formula: 11790
}
*/
const dynamicRules = require('dynamic-rules');
// This can be any javascript object
const myModel = {
amount: 118,
subtotal: 100,
taxes: 18,
typeDocument: {
name: 'INVOICE',
},
};
// This is the config dynamic-rules needs.
// model represents the parent of the object
const config = {
merge: true, // make a copy of your model and return the result on it.
condition: 'model.typeDocument.name === "INVOICE"',
formula: '(model.subtotal * model.amount) + 10',
};
const result = dynamicRules.execute(myModel, config);
console.log(result);
/*
{
model: {
amount: 118,
subtotal: 100,
taxes: 18,
typeDocument: {
name: 'INVOICE',
},
}
condition: true,
formula: 11790
}
*/
FAQs
evaluate javascript code according conditions and formulas
The npm package dynamic-rules receives a total of 0 weekly downloads. As such, dynamic-rules popularity was classified as not popular.
We found that dynamic-rules 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.