From f97352ee610d8c50e0ef71d842e3ebfc64e84315 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 23 May 2012 17:13:38 +0200 Subject: [PATCH] fix use of Ox.map, Ox.loop --- source/Ox.Image/Ox.Image.js | 4 ++-- source/Ox.Unicode/Ox.Unicode.js | 4 ++-- source/Ox/js/Core.js | 2 +- source/Ox/js/Date.js | 2 +- source/Ox/js/Encoding.js | 6 +++--- source/Ox/js/Format.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/Ox.Image/Ox.Image.js b/source/Ox.Image/Ox.Image.js index c6d02cab..4eff9243 100644 --- a/source/Ox.Image/Ox.Image.js +++ b/source/Ox.Image/Ox.Image.js @@ -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 diff --git a/source/Ox.Unicode/Ox.Unicode.js b/source/Ox.Unicode/Ox.Unicode.js index 3370b9ba..379a05cf 100644 --- a/source/Ox.Unicode/Ox.Unicode.js +++ b/source/Ox.Unicode/Ox.Unicode.js @@ -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); }); -} \ No newline at end of file +} diff --git a/source/Ox/js/Core.js b/source/Ox/js/Core.js index 36446411..ed2b61cd 100644 --- a/source/Ox/js/Core.js +++ b/source/Ox/js/Core.js @@ -245,7 +245,7 @@ Ox.loop For-loop, functional-style step Step value fn Iterator function i 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 diff --git a/source/Ox/js/Date.js b/source/Ox/js/Date.js index 82cbae68..0aa4a759 100644 --- a/source/Ox/js/Date.js +++ b/source/Ox/js/Date.js @@ -71,7 +71,7 @@ Ox.getDaysInMonth 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(); diff --git a/source/Ox/js/Encoding.js b/source/Ox/js/Encoding.js index d237e306..d3b9bfcb 100644 --- a/source/Ox/js/Encoding.js +++ b/source/Ox/js/Encoding.js @@ -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(''); + }); }; /*@ diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index 175e1d68..d56f0a56 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -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) {