use [].concat, not Ox.merge

This commit is contained in:
rolux 2012-05-24 09:45:33 +02:00
commit 1c40fb007b
27 changed files with 87 additions and 90 deletions

View file

@ -140,7 +140,7 @@ Ox.api = function(items, options) {
}
if (options.sort && result.data.items.length > 1) {
// sort
options.sort = parseSort(Ox.merge(Ox.clone(options.sort), api.sort));
options.sort = parseSort(options.sort.concat(api.sort));
options.sort.forEach(function(v) {
var key = v.key;
if (api.enums[key]) {
@ -417,7 +417,7 @@ Ox.range <f> Python-style range
@*/
Ox.range = function() {
var arr = [];
Ox.loop.apply(null, Ox.merge(Ox.toArray(arguments), function(i) {
Ox.loop.apply(null, Ox.toArray(arguments).concat(function(i) {
arr.push(i);
}));
return arr;
@ -433,7 +433,7 @@ Ox.range = function() {
var match;
if (Ox.isString(val)) {
match = arr_[i].match(/\d+/g);
match && Ox.merge(matches, match);
match && matches.concat(match);
}
});
// get length of longest number

View file

@ -193,7 +193,7 @@ Ox.Log = (function() {
return log.filter;
};
that.filter.add = function(val) {
return that.filter(Ox.unique(Ox.merge(log.filter, Ox.makeArray(val))));
return that.filter(Ox.unique(log.filter.concat(Ox.makeArray(val))));
};
that.filter.disable = function() {
log.filterEnabled = false;

View file

@ -28,7 +28,7 @@ Ox.cache = function(fn, options) {
if (options.async) {
if (!(key in cache)) {
// call function with patched callback
fn.apply(this, Ox.merge(Ox.sub(args, 0, -1), callback));
fn.apply(this, args.slice(0, -1).concat(callback));
} else {
// call callback with cached arguments
callback.apply(this, cache[key])

View file

@ -321,7 +321,7 @@
// intersect each part of the intersection
// with all parts of the next area
intersections = Ox.compact(ret.map(function(part) {
return Ox.intersectAreas(Ox.merge(part, parts));
return Ox.intersectAreas(parts.concat(part));
}));
ret = intersections.length == 0 ? null
: Ox.joinAreas(intersections);

View file

@ -172,8 +172,8 @@ Ox.doc = (function() {
lastItem.properties = lastItem.properties || [];
lastItem.properties.push(item);
// include leading linebreaks and whitespace
lastItem.source = Ox.merge(
lastItem.source, parseTokens(tokens[i], true)
lastItem.source = lastItem.source.concat(
parseTokens(tokens[i], true)
);
}
} else {
@ -294,7 +294,7 @@ Ox.doc = (function() {
counter = 0, items = [];
files && files.forEach(function(file) {
Ox.get(file, function(source) {
items = Ox.merge(items, parseSource(source, file));
items = items.concat(parseSource(source, file));
++counter == files.length && callback(items);
});
});

View file

@ -88,7 +88,7 @@ Ox.highlightHTML = function(html, str, classname, tags) {
position,
positions = [];
//fixme: default tags should be same as in parseHTML
tags = Ox.merge(tags || [], [
tags = (tags || []).concat([
// inline formatting
'b', 'code', 'i', 's', 'sub', 'sup', 'u',
// block formatting
@ -401,8 +401,8 @@ Ox.repeat = function(val, num) {
var ret;
if (Ox.isArray(val)) {
ret = [];
num >= 1 && Ox.loop(num, function() {
ret = Ox.merge(ret, val);
Ox.loop(num, function() {
ret = ret.concat(val);
});
} else {
ret = num >= 1 ? new Array(num + 1).join(val.toString()) : '';