[Pkg-javascript-commits] [node-module-deps] 16/444: take an opts param and pass it through to required

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:39 UTC 2017


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

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

commit cf523c85303de2fd69fc6fcffa3f54b45aa6881c
Author: James Halliday <mail at substack.net>
Date:   Tue Feb 19 14:36:11 2013 +1000

    take an opts param and pass it through to required
---
 index.js        | 6 ++++--
 readme.markdown | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index b406953..ac17a79 100644
--- a/index.js
+++ b/index.js
@@ -4,7 +4,7 @@ var path = require('path');
 var required = require('required');
 var Stream = require('stream');
 
-module.exports = function (mains) {
+module.exports = function (mains, opts) {
     if (!Array.isArray(mains)) mains = [ mains ].filter(Boolean);
     mains = mains.map(function (file) {
         return path.resolve(file);
@@ -17,7 +17,9 @@ module.exports = function (mains) {
     var output = new Stream;
     output.readable = true;
     
-    var opts = { cache: cache, includeSource: true };
+    if (!opts) opts = {};
+    if (opts.cache === undefined) opts.cache = cache;
+    opts.includeSource = true;
     
     mains.forEach(function (file) {
         pending ++;
diff --git a/readme.markdown b/readme.markdown
index a6809cf..dae94d0 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -54,11 +54,14 @@ usage: module-deps [files]
 var mdeps = require('module-deps')
 ```
 
-## mdeps(files)
+## mdeps(files, opts={})
 
 Return a readable stream of javascript objects from an array of filenames
 `files`.
 
+Optionally pass in `opts` that will be fed through into the underlying
+[required](https://github.com/shtylman/node-required) module.
+
 # install
 
 With [npm](http://npmjs.org), to get the module do:

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



More information about the Pkg-javascript-commits mailing list