forked from 0x2620/oxjs
less obscure Ox.map
This commit is contained in:
parent
33390069b9
commit
12cf77cef5
21 changed files with 125 additions and 101 deletions
|
|
@ -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 ? ':' : ' ');
|
||||
};
|
||||
|
||||
/*@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue