[Pkg-javascript-commits] [node-detective] 15/119: Quick return if there are no require() calls - greatly speeds up parsing files like jQuery.
Bastien Roucariès
rouca at moszumanska.debian.org
Wed Sep 6 09:44:30 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 acb5f6144a4539dbdc6a15e199956ceca30f2057
Author: Alex MacCaw <maccman at gmail.com>
Date: Wed Aug 3 15:05:59 2011 -0500
Quick return if there are no require() calls - greatly speeds up parsing files like jQuery.
---
index.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/index.js b/index.js
index 31a2066..5208762 100644
--- a/index.js
+++ b/index.js
@@ -6,6 +6,8 @@ var exports = module.exports = function (src) {
exports.find = function (src) {
var modules = { strings : [], expressions : [] };
+
+ if (src.indexOf('require(') == -1) return modules;
burrito(src, function (node) {
var isRequire = node.name === 'call'
--
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