fix regression from fb5c01c073
is_digit takes a char code now, not a string
This commit is contained in:
parent
b51fe0dcc3
commit
370d3e0917
10
lib/scope.js
10
lib/scope.js
|
|
@ -450,13 +450,13 @@ var base54 = (function() {
|
||||||
var chars, frequency;
|
var chars, frequency;
|
||||||
function reset() {
|
function reset() {
|
||||||
frequency = Object.create(null);
|
frequency = Object.create(null);
|
||||||
chars = string.split("");
|
chars = string.split("").map(function(ch){ return ch.charCodeAt(0) });
|
||||||
chars.map(function(ch){ frequency[ch] = 0 });
|
chars.forEach(function(ch){ frequency[ch] = 0 });
|
||||||
}
|
}
|
||||||
base54.consider = function(str){
|
base54.consider = function(str){
|
||||||
for (var i = str.length; --i >= 0;) {
|
for (var i = str.length; --i >= 0;) {
|
||||||
var ch = str.charAt(i);
|
var code = str.charCodeAt(i);
|
||||||
++frequency[ch];
|
if (code in frequency) ++frequency[code];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
base54.sort = function() {
|
base54.sort = function() {
|
||||||
|
|
@ -473,7 +473,7 @@ var base54 = (function() {
|
||||||
function base54(num) {
|
function base54(num) {
|
||||||
var ret = "", base = 54;
|
var ret = "", base = 54;
|
||||||
do {
|
do {
|
||||||
ret += chars[num % base];
|
ret += String.fromCharCode(chars[num % base]);
|
||||||
num = Math.floor(num / base);
|
num = Math.floor(num / base);
|
||||||
base = 64;
|
base = 64;
|
||||||
} while (num > 0);
|
} while (num > 0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user