Files
less.js/lib/less/node/dimension.js

24 lines
696 B
JavaScript

if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', '..', 'less', 'tree')); }
tree.Dimension = function Dimension(value, unit) {
this.value = parseFloat(value);
this.unit = unit || null;
};
tree.Dimension.prototype = {
eval: function () { return this },
toColor: function () {
return new(tree.Color)([this.value, this.value, this.value]);
},
toCSS: function () {
var css = this.value + this.unit;
return css;
},
operate: function (op, other) {
return new(tree.Dimension)
(tree.operate(op, this.value, other.value),
this.unit || other.unit);
}
};