Update scope.js

fix the random output of base54 function.I haven't figure it out why,but the result array of string.split("") can be random in certain case. this will be a bug in mangling properties for multiple files.
This commit is contained in:
dom 2015-06-09 09:23:00 +08:00
parent c6fa291571
commit 9c2238dad9

View File

@ -480,7 +480,11 @@ var base54 = (function() {
var chars, frequency; var chars, frequency;
function reset() { function reset() {
frequency = Object.create(null); frequency = Object.create(null);
chars = string.split("").map(function(ch){ return ch.charCodeAt(0) }); var length = string.length;
chars = [];
for(var i=0;i<length;i++){
chars.push(string.charCodeAt(i));
}
chars.forEach(function(ch){ frequency[ch] = 0 }); chars.forEach(function(ch){ frequency[ch] = 0 });
} }
base54.consider = function(str){ base54.consider = function(str){