on master help sign in
Add a bunch of functions to classify chars.

Remove an unnecessary `console.log`

commit6a4cf28866b026c2e4e10f55f7d10b22dee38be1 authorevancz <info@elm-lang.org> dateThu 4 Oct 2012, 00:39 (14 years ago) parent8b72e0d
2 files changed+15−2
core-js/Data.js+15−1 core-js/Graphics/Element.js−1
core-js/Data.js+15−1
@@ -2,12 +2,26 @@
22var Data = function() {
33
44var Char = function() {
5+ function isBetween(lo,hi) { return function(chr) {
6+ var c = chr.charCodeAt(0);
7+ return lo <= c && c <= hi;
8+ };
9+ }
10+ var isDigit = isBetween('0'.charCodeAt(0),'9'.charCodeAt(0));
11+ var chk1 = isBetween('a'.charCodeAt(0),'f'.charCodeAt(0));
12+ var chk2 = isBetween('A'.charCodeAt(0),'F'.charCodeAt(0));
13+
514 return {fromCode : function(c) { return String.fromCharCode(c); },
615 toCode : function(c) { return c.charCodeAt(0); },
716 toUpper : function(c) { return c.toUpperCase(); },
817 toLower : function(c) { return c.toLowerCase(); },
918 toLocaleUpper : function(c) { return c.toLocaleUpperCase(); },
10− toLocaleLower : function(c) { return c.toLocaleLowerCase(); }
19+ toLocaleLower : function(c) { return c.toLocaleLowerCase(); },
20+ isLower : isBetween('a'.charCodeAt(0),'z'.charCodeAt(0)),
21+ isUpper : isBetween('A'.charCodeAt(0),'Z'.charCodeAt(0)),
22+ isDigit : isDigit,
23+ isOctDigit : isBetween('0'.charCodeAt(0),'7'.charCodeAt(0)),
24+ isHexDigit : function(c) { return isDigit(c) || chk1(c) || chk2(c); }
1125 };
1226}();
1327
core-js/Graphics/Element.js−1
@@ -263,7 +263,6 @@ ElmCode.Graphics.Element = function() {
263263 src = Foreign.JavaScript.castStringToJSString(src);
264264 var img = new Image();
265265 img.onload = function() {
266− console.log('loaded');
267266 Dispatcher.notify(pics.id,
268267 image_57(this.width)(this.height)(src));
269268 };