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:
parent
5cabb679f9
commit
5692195509
21 changed files with 88 additions and 88 deletions
|
|
@ -185,13 +185,13 @@ Ox.Log = (function() {
|
|||
that.filter = function(val) {
|
||||
if (!Ox.isUndefined(val)) {
|
||||
that.filter.enable();
|
||||
log.filter = Ox.toArray(val);
|
||||
log.filter = Ox.makeArray(val);
|
||||
storage('log', log);
|
||||
}
|
||||
return log.filter;
|
||||
};
|
||||
that.filter.add = function(val) {
|
||||
return that.filter(Ox.unique(Ox.merge(log.filter, Ox.toArray(val))));
|
||||
return that.filter(Ox.unique(Ox.merge(log.filter, Ox.makeArray(val))));
|
||||
};
|
||||
that.filter.disable = function() {
|
||||
log.filterEnabled = false;
|
||||
|
|
@ -202,13 +202,13 @@ Ox.Log = (function() {
|
|||
storage('log', log);
|
||||
};
|
||||
that.filter.remove = function(val) {
|
||||
val = Ox.toArray(val);
|
||||
val = Ox.makeArray(val);
|
||||
return that.filter(log.filter.filter(function(v) {
|
||||
return val.indexOf(v) == -1;
|
||||
}));
|
||||
};
|
||||
that.log = function() {
|
||||
var args = Ox.makeArray(arguments), date, ret;
|
||||
var args = Ox.toArray(arguments), date, ret;
|
||||
if (!log.filterEnabled || log.filter.indexOf(args[0]) > -1) {
|
||||
date = new Date();
|
||||
args.unshift(
|
||||
|
|
@ -264,7 +264,7 @@ Ox.loop = function() {
|
|||
};
|
||||
|
||||
Ox._loop = function() {
|
||||
var type = Ox.toArray(arguments).map(function(arg) {
|
||||
var type = Ox.makeArray(arguments).map(function(arg) {
|
||||
return Ox.typeOf(arg);
|
||||
}),
|
||||
fnIndex = type.indexOf('function'),
|
||||
|
|
@ -315,7 +315,7 @@ Ox.print <f> Prints its arguments to the console
|
|||
@*/
|
||||
|
||||
Ox.print = function() {
|
||||
var args = Ox.makeArray(arguments),
|
||||
var args = Ox.toArray(arguments),
|
||||
date = new Date();
|
||||
args.unshift(
|
||||
Ox.formatDate(date, '%H:%M:%S.') + (+date).toString().substr(-3)/*,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue