removed lib/ext, moved lib/less.js to /index.js, moved Array/find to tree.find
This commit is contained in:
parent
3a474c9bae
commit
24bba952c7
@ -6,7 +6,7 @@ var path = require('path'),
|
||||
|
||||
require.paths.unshift(__dirname, path.join(__dirname, '..'));
|
||||
|
||||
var less = require('lib/less');
|
||||
var less = require('index');
|
||||
var args = process.argv.slice(1);
|
||||
|
||||
args = args.filter(function (arg) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
var path = require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
require.paths.unshift(__dirname);
|
||||
require.paths.unshift(path.join(__dirname, 'lib'));
|
||||
|
||||
var less = {
|
||||
version: [2, 0, 0],
|
||||
@ -86,7 +86,6 @@ less.Parser.importer = function (file, paths, callback) {
|
||||
}
|
||||
|
||||
require('less/functions');
|
||||
require('ext/array');
|
||||
|
||||
for (var k in less) { exports[k] = less[k] }
|
||||
|
@ -1,6 +0,0 @@
|
||||
Array.prototype.find = function (fun) {
|
||||
for (var i = 0, r; i < this.length; i++) {
|
||||
if (r = fun.call(this, this[i])) { return r }
|
||||
}
|
||||
return null;
|
||||
};
|
@ -9,3 +9,9 @@ tree.operate = function (op, a, b) {
|
||||
}
|
||||
};
|
||||
|
||||
tree.find = function (obj, fun) {
|
||||
for (var i = 0, r; i < obj.length; i++) {
|
||||
if (r = fun.call(obj, obj[i])) { return r }
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
@ -6,8 +6,8 @@ tree.Variable.prototype = {
|
||||
eval: function (env) {
|
||||
var variable, name = this.name;
|
||||
|
||||
if (variable = env.frames.find(function (frame) {
|
||||
return frame.variables().find(function (variable) {
|
||||
if (variable = tree.find(env.frames, function (frame) {
|
||||
return tree.find(frame.variables(), function (variable) {
|
||||
if (variable.name === name) {
|
||||
return variable.value.eval ? variable.value.eval(env)
|
||||
: variable.value;
|
||||
|
@ -4,7 +4,7 @@ var path = require('path'),
|
||||
|
||||
require.paths.unshift(__dirname, path.join(__dirname, '..'));
|
||||
|
||||
var less = require('lib/less');
|
||||
var less = require('index');
|
||||
|
||||
less.tree.functions.add = function (a, b) {
|
||||
return new(less.tree.Dimension)(a.value + b.value);
|
||||
|
Loading…
Reference in New Issue
Block a user