merge misc. minor changes

This commit is contained in:
rolux 2012-05-19 12:30:43 +04:00
parent 6acfd505e6
commit 5cabb679f9
3 changed files with 17 additions and 0 deletions

View file

@ -87,6 +87,18 @@ Ox.load({UI: {showScreen: true}, Geo: {}}, function() {
}; };
/**/ /**/
}); });
/*
Ox.print(
JSON.stringify(
cities.sort(function(a, b) {
return a.country + ', ' + a.name < b.country + ', ' + b.name ? -1
: a.country + ', ' + a.name > b.country + ', ' + b.name ? 1 : 0
}).map(function(city) {
return city.name + ', ' + city.country
})
)
);
*/
var listAPI = Ox.api(cities, { var listAPI = Ox.api(cities, {
cache: true, cache: true,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -356,6 +356,10 @@ Ox.flatten = function(arr) {
return ret; return ret;
}; };
Ox.indexOf = function(arr) {
// indexOf for primitives, test for function, deep equal for others
};
/*@ /*@
Ox.merge <f> Merges an array with one or more other arrays Ox.merge <f> Merges an array with one or more other arrays
For convenience, literals are treated as arrays with one element For convenience, literals are treated as arrays with one element
@ -364,6 +368,7 @@ Ox.merge <f> Merges an array with one or more other arrays
> Ox.merge(1, [2, 3, 2], 1) > Ox.merge(1, [2, 3, 2], 1)
[1, 2, 3, 2, 1] [1, 2, 3, 2, 1]
@*/ @*/
// FIXME: a1.push.apply(a1, a2) should be much faster
Ox.merge = function(arr) { Ox.merge = function(arr) {
arr = Ox.toArray(arr); arr = Ox.toArray(arr);
Ox.forEach(Array.prototype.slice.call(arguments, 1), function(arg) { Ox.forEach(Array.prototype.slice.call(arguments, 1), function(arg) {