typo; fix a test

This commit is contained in:
rolux 2012-05-25 09:33:34 +02:00
parent 8aa2e7f29c
commit 61bb1c3598

View file

@ -279,7 +279,7 @@ Ox.formatDateRange = function(start, end, utc) {
if (i == precision[0] - 1 && parts[0][i] != parts[1][i] - 1) {
isOneUnit = false;
}
!isOneUnit && Ox.Break()();
!isOneUnit && Ox.Break();
});
}
if (isOneUnit) {
@ -561,10 +561,21 @@ Ox.formatString = function (str, obj) {
});
};
/*@
Ox.formatUnit <f> Formats a number with a unit
> Ox.formatUnit(0.333333, '%', 2, 100)
"33.33%"
@*/
Ox.formatUnit = function(num, str, dec, factor) {
dec = Ox.isUndefined(dec) ? 3 : dec;
factor = Ox.isUndefined(factor) ? 1 : factor;
return Ox.formatNumber(num * factor, dec) + (str == '%' ? '' : ' ') + str;
};
/*@
Ox.formatValue <f> Formats a numerical value
> Ox.formatValue(0, "B")
"0 KB"
"0 B"
> Ox.formatValue(123456789, "B")
"123.5 MB"
> Ox.formatValue(1234567890, "B", true)
@ -577,25 +588,14 @@ Ox.formatValue = function(num, str, bin) {
val;
Ox.forEach(Ox.PREFIXES, function(chr, i) {
if (num < Math.pow(base, i + 1) || i == len - 1) {
val = Ox.formatNumber(num / Math.pow(base, i), i ? i - 1 : 0) +
' ' + chr + (chr && bin ? 'i' : '') + str;
Ox.Break()();
val = Ox.formatNumber(num / Math.pow(base, i), i ? i - 1 : 0)
+ ' ' + chr + (chr && bin ? 'i' : '') + str;
Ox.Break();
}
});
return val;
};
/*@
Ox.formatUnit <f> Formats a number with a unit
> Ox.formatUnit(0.333333, '%', 2, 100)
"33.33%"
@*/
Ox.formatUnit = function(num, str, dec, factor) {
dec = Ox.isUndefined(dec) ? 3 : dec;
factor = Ox.isUndefined(factor) ? 1 : factor;
return Ox.formatNumber(num * factor, dec) + (str == '%' ? '' : ' ') + str;
};
/*@
Ox.parseDuration <f> Takes a formatted duration, returns seconds
> Ox.parseDuration('01:02:03')