math-to-js
v1.0.0
Published
Turns math expressions to JS, like "3 × 4" => "3 * 4".
Maintainers
Readme
Math to JS 1.0.0
Math to JS is a tiny tool to turn math expressions to JavaScript.
npm install math-to-jsconst mathToJS = require('math-to-js')
eval(mathToJS("4 × 3")) // 12(ignores spaces)
Supported expressions:
n × n => n * n
n ÷ n => n / n
nⁿ => n ** n
Also works with commas instead of dots:
mathToJS("4,12") // 4.12© NPMUCK You 2026
