insert-module-globals
Advanced tools
Comparing version 1.1.1 to 1.1.2
31
index.js
@@ -57,9 +57,8 @@ var parseScope = require('lexical-scope'); | ||
); | ||
var varNames = Object.keys(vars) | ||
var quick = varNames.map(function (name) { | ||
return new RegExp('\\b'+name+'\\b', 'g') | ||
}) | ||
var varNames = Object.keys(vars); | ||
var quick = RegExp(varNames.map(function (name) { | ||
return '\\b' + name + '\\b'; | ||
}).join('|')); | ||
var resolved = {}; | ||
@@ -70,10 +69,11 @@ | ||
function write (row) { | ||
var tr = this; | ||
//remove hashbang if present | ||
row.source = String(row.source).replace(/^#![^\n]*\n/, '\n'); | ||
if (!opts.always | ||
&& quick.every(function (rx) { return !rx.test(row.source) }) | ||
) return this.queue(row); | ||
if (opts.always !== true && !quick.test(row.source)) { | ||
return tr.queue(row); | ||
} | ||
var scope = opts.always | ||
@@ -83,7 +83,6 @@ ? { globals: { implicit: varNames } } | ||
; | ||
var globals = {}; | ||
var tr = this; | ||
Object.keys(vars).forEach(function (name) { | ||
varNames.forEach(function (name) { | ||
if (scope.globals.implicit.indexOf(name) >= 0) { | ||
@@ -90,0 +89,0 @@ var value = vars[name].call(tr, row, basedir); |
{ | ||
"name": "insert-module-globals", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "insert implicit module globals into a module-deps stream", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121105