aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-10-13 12:24:27 +0300
committerMihai Bazon <mihai@bazon.net>2012-10-13 12:24:27 +0300
commit370d3e09172c35e4f0a7c6a47edd53625b6e2012 (patch)
tree56f2bc1c71ec42776ead86978406b10a256852ec /lib/scope.js
parentb51fe0dcc348fe2c3942b04c7c7d88f3fb7eaa49 (diff)
downloadtracifyjs-370d3e09172c35e4f0a7c6a47edd53625b6e2012.tar.gz
tracifyjs-370d3e09172c35e4f0a7c6a47edd53625b6e2012.zip
fix regression from fb5c01c073d06034815d5f3b782fd11cbdf6d6f5
is_digit takes a char code now, not a string
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/scope.js b/lib/scope.js
index acc6fa25..eebedfd8 100644
--- a/lib/scope.js
+++ b/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);