[Pkg-javascript-commits] [node-detective] 53/119: fix for module-level returns

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:44:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-detective.

commit 3fad0d21d3913042a96528c2009e5a7b1cd8349a
Author: James Halliday <mail at substack.net>
Date:   Wed Apr 17 13:23:28 2013 -0700

    fix for module-level returns
---
 index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 56f3266..5188b7f 100644
--- a/index.js
+++ b/index.js
@@ -32,7 +32,7 @@ exports.find = function (src, opts) {
     if (!opts) opts = {};
     var word = opts.word === undefined ? 'require' : opts.word;
     if (typeof src !== 'string') src = String(src);
-    src = src.replace(/^#![^\n]*\n/, '');
+    src = '(function(){' + src.replace(/^#![^\n]*\n/, '') + '\n})()';
     
     function isRequire (node) {
         var c = node.callee;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-detective.git



More information about the Pkg-javascript-commits mailing list