swap the meaning of makeArray and toArray: makeArray, like makeObject, is a helper function for arguments processing (that wraps any non-array in an array), toArray, like in other libraries, is an alias for Array.prototype.slice.call
This commit is contained in:
parent
5cabb679f9
commit
5692195509
21 changed files with 88 additions and 88 deletions
|
|
@ -41,7 +41,7 @@ Ox.getJSON = (function() {
|
|||
});
|
||||
}
|
||||
return function(url, callback) {
|
||||
var urls = Ox.toArray(url), data = {}, i = 0, n = urls.length;
|
||||
var urls = Ox.makeArray(url), data = {}, i = 0, n = urls.length;
|
||||
urls.forEach(function(url) {
|
||||
getJSON(url, function(data_) {
|
||||
data[url] = data_;
|
||||
|
|
@ -128,7 +128,7 @@ Ox.loadFile = (function() {
|
|||
}
|
||||
}
|
||||
function findFileInHead() {
|
||||
return Ox.makeArray(
|
||||
return Ox.toArray(
|
||||
document.getElementsByTagName(type == 'css' ? 'link' : 'script')
|
||||
).map(function(element) {
|
||||
return element[type == 'css' ? 'href' : 'src'] == file;
|
||||
|
|
@ -163,9 +163,9 @@ Ox.loadFiles <f> Loads multiple files (images, scripts or stylesheets)
|
|||
@*/
|
||||
Ox.loadFiles = (function() {
|
||||
function loadFiles(files, callback) {
|
||||
files = Ox.toArray(files);
|
||||
files = Ox.makeArray(files);
|
||||
var i = 0, n = files.length, images = {};
|
||||
Ox.toArray(files).forEach(function(file) {
|
||||
Ox.makeArray(files).forEach(function(file) {
|
||||
Ox.loadFile(file, function(image) {
|
||||
if (image) {
|
||||
images[file] = image;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue