6f990c9ce4
Change-Id: Ia8989da47a55f7c932115a976b6d799714b8dc56
18 lines
442 B
JavaScript
18 lines
442 B
JavaScript
(function (tree) {
|
|
|
|
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;
|
|
};
|
|
tree.jsify = function (obj) {
|
|
if (Array.isArray(obj.value) && (obj.value.length > 1)) {
|
|
return '[' + obj.value.map(function (v) { return v.toCSS(false) }).join(', ') + ']';
|
|
} else {
|
|
return obj.toCSS(false);
|
|
}
|
|
};
|
|
|
|
})(require('./tree'));
|