mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
16 lines
418 B
JavaScript
16 lines
418 B
JavaScript
var Dimension = require("../tree/dimension");
|
|
|
|
var MathHelper = function() {
|
|
};
|
|
MathHelper._math = function (fn, unit, n) {
|
|
if (!(n instanceof Dimension)) {
|
|
throw { type: "Argument", message: "argument must be a number" };
|
|
}
|
|
if (unit == null) {
|
|
unit = n.unit;
|
|
} else {
|
|
n = n.unify();
|
|
}
|
|
return new Dimension(fn(parseFloat(n.value)), unit);
|
|
};
|
|
module.exports = MathHelper; |