fix use of Ox.map, Ox.loop

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

View file

@ -345,7 +345,7 @@ Ox.load.Image = function(options, callback) {
// Array of bits per byte to be modified (0 is LSB)
bits = mode < 1 ? [-mode] : Ox.filter(Ox.range(8), function(i) {
return mode & 1 << i;
};
}),
cap = getCapacity(bits.length), len;
// Compress the string
str = Ox[deflate ? 'encodeDeflate' : 'encodeUTF8'](str);
@ -362,7 +362,7 @@ Ox.load.Image = function(options, callback) {
return Ox.range(8).map(function(i) {
return chr.charCodeAt(0) >> 7 - i & 1;
});
}));
}).split(','));
b = 0;
that.forEach(function(rgba, xy, index) {
// If alpha is not 255, the RGB values may not be preserved

View file

@ -93,11 +93,11 @@ Ox.load.Unicode = function(options, callback) {
Ox.toASCII = function(str) {
return Ox.map(str, function(chr) {
return chars[chr].ascii || chr;
}).join('');
});
};
callback(true);
});
}
}

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) {