1
0
Fork 0
forked from 0x2620/oxjs

fix use of Ox.map, Ox.loop

This commit is contained in:
j 2012-05-23 17:13:38 +02:00
commit f97352ee61
6 changed files with 10 additions and 10 deletions

View file

@ -245,7 +245,7 @@ Ox.loop <f> For-loop, functional-style
step <n> Step value
fn <f> Iterator function
i <n> Counter value
> Ox.loop(10, function(i) { return i != 4; })
> Ox.loop(10, function(i) { i == 4 && Ox.break() })
4
> Ox.loop(0, 3, 2, function() {})
4

View file

@ -71,7 +71,7 @@ Ox.getDaysInMonth <f> Get the number of days in a given month
Ox.getDaysInMonth = function(year, month) {
year = Ox.makeYear(year);
month = Ox.isNumber(month) ? month
: Ox.getIndexOf(Ox.MONTHS, function(v) {
: Ox.indexOf(Ox.MONTHS, function(v) {
return v.substr(0, 3) == month.substr(0, 3);
}) + 1;
return new Date(year, month, 0).getDate();

View file

@ -81,7 +81,7 @@
Ox.encodeBase32 = function(num) {
return Ox.map(num.toString(32), function(char) {
return Ox.BASE_32_DIGITS[parseInt(char, 32)];
}).join('');
});
};
/*@
@ -100,7 +100,7 @@
Ox.BASE_32_ALIASES[char] || char
);
return (index == -1 ? ' ' : index).toString(32);
}).join(''), 32);
}), 32);
};
/*@
@ -347,7 +347,7 @@
+ String.fromCharCode(code & 63 | 128);
}
return str;
}).join('');
});
};
/*@

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;
}
return isOneUnit;
!isOneUnit && Ox.break();
});
}
if (isOneUnit) {