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