modularity
Advanced tools
| module.exports = 'foo'; |
| module.exports = 'baz'; |
| module.exports = 'qux'; |
| module.exports = ['bar/baz', 'bar/baz_foo', 'bar/baz/qux', function (baz, foo, qux) { | ||
| return baz + foo + qux; | ||
| }]; | ||
+8
-3
@@ -72,8 +72,13 @@ var EventEmitter = require('events').EventEmitter | ||
| } | ||
| if (typeof module !== 'function') { | ||
| var module_deps; | ||
| if (Array.isArray(module)) { | ||
| module_deps = module; | ||
| module = module_deps.pop(); | ||
| } else if (typeof module === 'function') { | ||
| module_deps = parseArgs(module); | ||
| } else { | ||
| loaded[dependency] = self.cache[dependency] = module; | ||
| return next(); | ||
| } | ||
| var module_deps = parseArgs(module) | ||
| , module_ancestors = ancestors.concat([ dependency ]); | ||
| var module_ancestors = ancestors.concat([ dependency ]); | ||
| self.loadDependencies(module_deps, module_ancestors, | ||
@@ -80,0 +85,0 @@ module_path, function (err, modules) { |
+1
-1
| { | ||
| "name": "modularity", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "Module loader", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+7
-0
@@ -122,2 +122,9 @@ /*jshint unused:false */ | ||
| it('should support angular.js style array syntax', function (done) { | ||
| loadTest(9, function (foo) { | ||
| assert.equal(foo, 'bazfooqux'); | ||
| done(); | ||
| }); | ||
| }); | ||
| it('should include global modules by default', function (done) { | ||
@@ -124,0 +131,0 @@ loadTest(1, function (fs) { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
15252
3.86%30
15.38%322
5.57%0
-100%