1
0
Fork 0
forked from 0x2620/oxjs

minor changes, mostly documentation

This commit is contained in:
rlx 2012-03-30 14:11:29 +00:00
commit 25c25c76c7
4 changed files with 11 additions and 8 deletions

View file

@ -483,8 +483,9 @@ Ox.formatOrdinal <f> Formats a number as an ordinal
@*/
Ox.formatOrdinal = function(num) {
var str = num.toString(),
end = str[str.length - 1],
ten = str.length > 1 && str[str.length - 2] == '1';
len = str.length
end = str[len - 1],
ten = len > 1 && str[len - 2] == '1';
if (end == '1' && !ten) {
str += 'st';
} else if (end == '2' && !ten) {
@ -524,6 +525,8 @@ Ox.formatString <f> Basic string formatting
'foobar'
@*/
// fixme: Ox.formatRoman() ?
Ox.formatString = function (str, obj) {
return str.replace(/\{([^}]+)\}/g, function(str, match) {
return obj[match];