on master help sign in
Add a bunch of functions to classify chars.
6a4cf28evancz
core-js/Data.js+15−1
@@ -2,12 +2,26 @@
2var Data = function() {
2var Data = function() {
3
3
4var Char = function() {
4var 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+
5 return {fromCode : function(c) { return String.fromCharCode(c); },
14 return {fromCode : function(c) { return String.fromCharCode(c); },
6 toCode : function(c) { return c.charCodeAt(0); },
15 toCode : function(c) { return c.charCodeAt(0); },
7 toUpper : function(c) { return c.toUpperCase(); },
16 toUpper : function(c) { return c.toUpperCase(); },
8 toLower : function(c) { return c.toLowerCase(); },
17 toLower : function(c) { return c.toLowerCase(); },
9 toLocaleUpper : function(c) { return c.toLocaleUpperCase(); },
18 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); }
11 };
25 };
12}();
26}();
13
27
core-js/Graphics/Element.js−1
@@ -263,7 +263,6 @@ ElmCode.Graphics.Element = function() {
263 src = Foreign.JavaScript.castStringToJSString(src);
263 src = Foreign.JavaScript.castStringToJSString(src);
264 var img = new Image();
264 var img = new Image();
265 img.onload = function() {
265 img.onload = function() {
266− console.log('loaded');
267 Dispatcher.notify(pics.id,
266 Dispatcher.notify(pics.id,
268 image_57(this.width)(this.height)(src));
267 image_57(this.width)(this.height)(src));
269 };
268 };