Require tighter collision checking

This commit is contained in:
Pat Cavit 2016-07-29 23:52:22 -07:00
parent 49c3376db0
commit 16c892037b

View file

@ -73,7 +73,8 @@ module.exports = function(input, output, options) {
function fixCollisions(code) {
for (var variable in usedVariables) {
var collision = new RegExp("([^\\.])" + variable + "\\b(?![\"'`])", "g")
var collision = new RegExp("([^\\.])\\b" + variable + "\\b(?![\"'`])", "g")
// var collision = new RegExp("([^\\.])" + variable + "\\b(?![\"'`])", "g")
var exported = new RegExp("module\\.exports\\s*=\\s*" + variable)
if (collision.test(code) && !exported.test(code) && !globals[variable.match(/[^\.]+/)]) {
var fixed = variable + usedVariables[variable]++