add missing semicolon; less expensive Ox.print, with updated documentation; make sure Ox.uid never returns falsy ids

This commit is contained in:
rolux 2013-11-29 21:11:36 +01:00
parent 420dd7f266
commit 3ad31125b3

View file

@ -44,7 +44,7 @@ Ox.load = function() {
if (Ox.isString(value)) { if (Ox.isString(value)) {
modules[value] = {}; modules[value] = {};
} else { } else {
Ox.extend(modules, value) Ox.extend(modules, value);
} }
}); });
} else if (type == 'object') { } else if (type == 'object') {
@ -233,13 +233,13 @@ Ox.print <f> Prints its arguments to the console
The string contains the timestamp, the name of the caller function, and The string contains the timestamp, the name of the caller function, and
any arguments, separated by spaces any arguments, separated by spaces
arg <*> any value arg <*> any value
> Ox.print('foo').split(' ').pop() > Ox.print('foo', 'bar').split(' ').slice(1).join(' ')
"foo" 'foo bar'
@*/ @*/
Ox.print = function() { Ox.print = function() {
var args = Ox.toArray(arguments), date = new Date(); var args = Ox.slice(arguments), date = new Date();
args.unshift( args.unshift(
Ox.formatDate(date, '%H:%M:%S.') + (+date).toString().slice(-3) date.toString().split(' ')[4] + '.' + (+date).toString().slice(-3)
); );
window.console && window.console.log.apply(window.console, args); window.console && window.console.log.apply(window.console, args);
return args.join(' '); return args.join(' ');
@ -254,7 +254,7 @@ Ox.uid <f> Returns a unique id
Ox.uid = (function() { Ox.uid = (function() {
var uid = 0; var uid = 0;
return function() { return function() {
return uid++; return ++uid;
}; };
}()); }());