
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
calculator-lib
Advanced tools
Provides functions for evaluating infix (and RPN postfix) expressions, in JavaScript.
Source is in ES6, released as ES5. Transpiled using Babel.
npm install calculator-lib
const calculator = require('calculator-lib');
calculator('4 + 5'); // -> 9
calculator('2+3/(5^-1)*-1.5'); // -> -20.5
Currently, operations are limited to the following:
*
)/
)+
)-
)^
)Feel free to add more in a pull request! For example, trigonometric operations would come in handy...
const evaluatePostfix = require('calculator-lib/dist/evaluate-postfix');
evaluatePostfix('1 2 + 3 +'); // -> 6
evaluatePostfix('21 -3.2 *'); // -> -67.2
const infixToPostfix = require('calculator-lib/dist/infix-to-postfix');
infixToPostfix('21 ^ 3 * 2 - 10'); // -> '21 3 ^ 2 * 10 -'
FAQs
Calculate infix / postfix expressions
The npm package calculator-lib receives a total of 8 weekly downloads. As such, calculator-lib popularity was classified as not popular.
We found that calculator-lib 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.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.