codependency
Advanced tools
Comparing version 2.0.1 to 2.1.0
23
index.js
@@ -279,9 +279,11 @@ 'use strict'; | ||
* | ||
* @param {Module} baseModule The module that hosts the dependencies. | ||
* @param {Object} [options] Options object | ||
* @param {string[]} [options.index] Which dependencies to evaluate. | ||
* Default value: ["optionalPeerDependencies"] | ||
* @param {string} [options.name] A unique name to use for this middleware. | ||
* Default value is the "name" field from package.json. | ||
* @returns {function} The generated require function. | ||
* @param {Module} baseModule The module that hosts the dependencies. | ||
* @param {Object} [options] Options object | ||
* @param {string[]} [options.index] Which dependencies to evaluate. | ||
* Default value: ["optionalPeerDependencies"] | ||
* @param {string} [options.name] A unique name to use for this middleware. | ||
* Default value is the "name" field from package.json. | ||
* @param {boolean} [options.strictCheck] Check for `package.json` in base module only | ||
Default value: true | ||
* @returns {function} The generated require function. | ||
*/ | ||
@@ -294,3 +296,3 @@ | ||
var pkg = exports.findPackage(baseModule, true); | ||
var pkg = exports.findPackage(baseModule, options.strictCheck !== false); | ||
@@ -306,6 +308,3 @@ // decide on a name for this middleware | ||
if (middlewares.hasOwnProperty(middlewareName)) { | ||
throw new Error( | ||
'A middleware with name "' + middlewareName + '" has already ' + | ||
'been registered.' | ||
); | ||
return middlewares[ middlewareName ]; | ||
} | ||
@@ -312,0 +311,0 @@ |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Optional peer dependencies", | ||
@@ -14,0 +14,0 @@ "main": "index.js", |
@@ -86,2 +86,5 @@ # Optional Peer Dependencies for Node.js middleware | ||
If the `module` argument is not the root module you may set the `options.strictCheck` property to `false` | ||
to search for `package.json` in a parent directory. | ||
This function returns a `require` function, which has the following signature: | ||
@@ -88,0 +91,0 @@ |
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
20066
133
5
263