1
0
Fork 0
forked from 0x2620/oxjs

less obscure Ox.map

This commit is contained in:
rolux 2012-05-22 16:29:37 +02:00
commit 12cf77cef5
21 changed files with 125 additions and 101 deletions

View file

@ -366,9 +366,9 @@ Ox.formatDateRangeDuration = function(start, end, utc) {
}
}
});
return Ox.map(values, function(value, i) {
return value ? value + ' ' + keys[i] + (value > 1 ? 's' : '') : null;
}).join(' ');
return Ox.filter(Ox.map(values, function(value, i) {
return value ? value + ' ' + keys[i] + (value > 1 ? 's' : '') : '';
})).join(' ');
};
/*@
@ -450,7 +450,7 @@ Ox.formatDuration = function(/*sec, dec, format*/) {
str.shift();
pad.shift();
}
return Ox.map(val, function(v, i) {
return Ox.filter(Ox.map(val, function(v, i) {
var ret;
if (!format) {
ret = Ox.pad(v, pad[i]);
@ -458,10 +458,10 @@ Ox.formatDuration = function(/*sec, dec, format*/) {
ret = v + (format == 'long' ? ' ' : '') + str[i]
+ (format == 'long' && v != 1 ? 's' : '');
} else {
ret = null;
ret = '';
}
return ret;
}).join(!format ? ':' : ' ');
})).join(!format ? ':' : ' ');
};
/*@