
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.
calcfoundry
Advanced tools
A secure CLI tool for evaluating mathematical calculator specifications defined in JSON, with browser compatibility
A secure CLI tool that safely evaluates mathematical calculator specifications defined in JSON. Works in both Node.js and browser environments. Perfect for medical calculators, risk scores, and complex mathematical models.
eval() or arbitrary code executionnpm install -g calcfoundry
npm install calcfoundry
# Works with Vite, Webpack, and other bundlers
npm install calcfoundry
// ES6 import (browser/Vite/Webpack)
import { evaluateCalculator } from 'calcfoundry/browser';
# Run a calculator with custom inputs
calcf run ./sample_calcs/bmi.json --inputs '{"height_cm":180,"weight_kg":75}'
# Run a calculator with test fixture
calcf run ./sample_calcs/bmi.json --fixture "BMI 80kg/170cm"
# Run all tests for a calculator
calcf test ./sample_calcs/bmi.json
# Get help
calcf --help
{
"bmi_value": 23.1
}
npm run example:bmi
# Output: {"bmi_value": 23.1}
npm run example:chadsvasc
# Output: {"cha2ds2_vasc_score": 3, "oac_recommendation": "Recommend OAC"}
npm run example:kfre
# Output: {"risk_5y": 0.0367}
Calculators are defined as JSON files with the following structure:
{
"meta": {
"id": "my_calculator",
"title": "My Calculator",
"license": "CC-BY-4.0"
},
"inputs": [
{
"name": "age",
"label": "Age (years)",
"type": "number",
"constraints": {"min": 0, "max": 120, "required": true},
"default": 30
}
],
"constants": [
{"name": "pi", "value": 3.14159}
],
"derived": [
{
"name": "age_squared",
"expr": {"language": "mathjs", "source": "age ^ 2"}
}
],
"outputs": [
{
"name": "result",
"label": "Final Result",
"expr": {"language": "mathjs", "source": "age_squared * pi"},
"round": {"mode": "fixed", "digits": 2}
}
],
"tests": [
{
"name": "Test case 1",
"inputs": {"age": 25},
"expect": [{"name": "result", "equals": 1963.49, "tolerance": 0.01}]
}
],
"version": "0.1.0"
}
number, integer, boolean, enum, string+, -, *, /, ^, comparison operatorsabs, min, max, sqrt, exp, log, log10, round, floor, ceil, powcondition ? value1 : value2# Run single test
npm test
# Run all example calculators
npm run test:all
# Run examples
npm run example:bmi
npm run example:chadsvasc
npm run example:kfre
Calcfoundry includes validated implementations of common medical calculators:
import { loadCalculator, validateCalculator, evaluateCalculator } from 'calcfoundry';
// Load and validate calculator from file
const calculator = await loadCalculator('./my-calc.json');
const { dependencies } = validateCalculator(calculator);
// Evaluate with inputs
const result = evaluateCalculator(calculator, {age: 30, weight: 70}, dependencies);
console.log(result.outputs);
import { evaluateCalculator } from 'calcfoundry/browser';
// Calculator data already loaded as object
const calculatorData = {
meta: { id: "example", title: "Example", license: "MIT" },
inputs: [{ name: "x", type: "number" }],
constants: [],
derived: [],
outputs: [{ name: "result", expr: { source: "x * 2" } }],
tests: [],
version: "1.0"
};
// Direct evaluation (validation included)
const result = evaluateCalculator(calculatorData, { x: 5 });
console.log(result.outputs); // { result: 10 }
import { validateCalculatorData, evaluateCalculatorData } from 'calcfoundry/browser';
// Separate validation and evaluation steps
const { dependencies } = validateCalculatorData(calculatorData);
const result = evaluateCalculatorData(calculatorData, inputs, dependencies);
git checkout -b feature-namenpm run test:allgit commit -am 'Add feature'git push origin feature-nameMIT License - see the LICENSE file for details.
medical-calculator, clinical-score, math-evaluation, json-schema, safe-evaluation, mathjs, cli-tool, browser-compatible, isomorphic, bmi, cha2ds2-vasc, kfre
FAQs
A secure CLI tool for evaluating mathematical calculator specifications defined in JSON, with browser compatibility
We found that calcfoundry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.