on master help sign in
Fix Char ops
commit141580fa03b70230dc269e0dd6431935f58b49f8 authorMax New <maxsnew@gmail.com> dateMon 9 Jun 2014, 21:41 (12 years ago) parent5ef362e
1 file changed+6−4
libraries/Native/Char.js+6−4
libraries/Native/Char.js+6−4
@@ -4,6 +4,8 @@ Elm.Native.Char.make = function(elm) {
44 elm.Native.Char = elm.Native.Char || {};
55 if (elm.Native.Char.values) return elm.Native.Char.values;
66
7+ var Utils = Elm.Native.Utils.make(elm);
8+
79 function isBetween(lo,hi) { return function(chr) {
810 var c = chr.charCodeAt(0);
911 return lo <= c && c <= hi;
@@ -16,10 +18,10 @@ Elm.Native.Char.make = function(elm) {
1618 return elm.Native.Char.values = {
1719 fromCode : function(c) { return String.fromCharCode(c); },
1820 toCode : function(c) { return c.toUpperCase().charCodeAt(0); },
19− toUpper : function(c) { return c.toUpperCase(); },
20− toLower : function(c) { return c.toLowerCase(); },
21− toLocaleUpper : function(c) { return c.toLocaleUpperCase(); },
22− toLocaleLower : function(c) { return c.toLocaleLowerCase(); },
21+ toUpper : function(c) { return Utils.chr(c.toUpperCase()); },
22+ toLower : function(c) { return Utils.chr(c.toLowerCase()); },
23+ toLocaleUpper : function(c) { return Utils.chr(c.toLocaleUpperCase()); },
24+ toLocaleLower : function(c) { return Utils.chr(c.toLocaleLowerCase()); },
2325 isLower : isBetween('a'.charCodeAt(0),'z'.charCodeAt(0)),
2426 isUpper : isBetween('A'.charCodeAt(0),'Z'.charCodeAt(0)),
2527 isDigit : isDigit,