1
0
Fork 0
forked from 0x2620/oxjs

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:
rolux 2012-05-19 12:40:59 +04:00
commit 5692195509
21 changed files with 88 additions and 88 deletions

View file

@ -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;