
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@beyondessential/arithmetic
Advanced tools
Utility to evaluate BODMAS arithmetic formulas. It is an implementation of the shunting yard algorithm.
With yarn
:
yarn add @beyondessential/arithmetic
With npm
:
npm add @beyondessential/arithmetic
formulaText
must be in BODMAS format.
runArithmetic(formulaText: string, values?: Record<string, string | number>): number
Usage example:
import { runArithmetic } from '@beyondessential/arithmetic';
const value = runArithmetic('(-1 + 2.5) / 3');
console.log(value); // 0.5
const valueWithVariable = runArithmetic('2 * four', {
four: 4,
});
console.log(valueWithVariable); // 8
getVariables(formulaText: string): string[]
Usage example:
import { getVariables } from '@beyondessential/arithmetic';
const variables = getVariables('(-a * b - 1) / (c + 3)');
console.log(variables); // ['a', 'b', 'c']
Note: All operators are case insensitive.
Operator | Example | Description |
---|---|---|
+ | 1 + 1 | Addition |
- | 1 - 1 | Subtraction |
* or x | 1 * 1 or 1 x 1 | Multiplication |
/ | 1 / 1 | Division |
() | 1 / (1 + 1) | Brackets |
- | -1 | Unary minus |
max | max(1, 2, 3) | Takes the maximum value of it's arguments. -Infinity if given none |
FAQs
Utility to evaluate BODMAS arithmetic formulas
The npm package @beyondessential/arithmetic receives a total of 0 weekly downloads. As such, @beyondessential/arithmetic popularity was classified as not popular.
We found that @beyondessential/arithmetic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.