Sha256: ebb7730f8d4ec13244f3bf99f0a4910264a80e00d015097dd1d17a3b0e9a3e34
Contents?: true
Size: 714 Bytes
Versions: 5
Compression:
Stored size: 714 Bytes
Contents
var functionRegistry = require("./function-registry"), mathHelper = require("./math-helper.js"); var mathFunctions = { // name, unit ceil: null, floor: null, sqrt: null, abs: null, tan: "", sin: "", cos: "", atan: "rad", asin: "rad", acos: "rad" }; for (var f in mathFunctions) { if (mathFunctions.hasOwnProperty(f)) { mathFunctions[f] = mathHelper._math.bind(null, Math[f], mathFunctions[f]); } } mathFunctions.round = function (n, f) { var fraction = typeof f === "undefined" ? 0 : f.value; return mathHelper._math(function(num) { return num.toFixed(fraction); }, null, n); }; functionRegistry.addMultiple(mathFunctions);
Version data entries
5 entries across 5 versions & 2 rubygems