mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
node.operate, to operate on values, based on a string op
This commit is contained in:
@@ -5,6 +5,7 @@ require.paths.unshift(path.join(__dirname, '..', '..'));
|
||||
var less = require('less');
|
||||
|
||||
process.mixin(less, require('less/parser'));
|
||||
process.mixin(less.parser, require(path.join('less', 'node')));
|
||||
|
||||
['color', 'directive', 'operation', 'dimension',
|
||||
'keyword', 'variable', 'ruleset', 'element',
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
node.operate = function (op, a, b) {
|
||||
switch (op) {
|
||||
case '+': return a + b;
|
||||
case '-': return a - b;
|
||||
case '*': return a * b;
|
||||
case '/': return a / b;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user