
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@leanylabs/formula-engine
Advanced tools
Extendable formula parser and executor.
Typical expression may look like this:
'the answer is: ' + TO_STRING(POW(2, {var}) + 10)
The computed result, given var = 5 would be a string: 'the answer is: 42'.
Where TO_STRING and POW are functions that you provide implementation for.
Also {var} is a variable, you should also provide a value resolver for those.
function resolveReferences(names: string[]): Record<string, any> {
// your implementation to resolve variables
return {
a: 10,
b: 20,
};
}
const functions = {
// your custom functions
TO_STRING(val) {
return String(val);
},
POW(x, a) {
return Math.pow(x, a);
},
};
const engine = new FormulaEngine(resolveReferences, functions);
Note: all functions should be provided by the user, nothing is included by default. It is mostly to avoid conflicts and make the library reusable.
It supports three types of literals (data types):
Currently type checking is not implemented, so the engine is relying on JS type coercion. Be careful with it, the result may be not always obvious (if you subtract string from a number for example).
This is very much work in progress, but is is working for the main use cases, so we believe it can be useful already.
FAQs
Extendable formula parser and executor.
We found that @leanylabs/formula-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.