[Pkg-javascript-commits] [node-module-deps] 121/444: opts.includeIndex to include the deterministic index

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:48 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 a8d455b0849d246bf4a0618add5afee0a3967ca9
Author: James Halliday <mail at substack.net>
Date:   Mon Jul 8 17:56:25 2013 -0700

    opts.includeIndex to include the deterministic index
---
 index.js | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index 35b8016..fe6e1f7 100644
--- a/index.js
+++ b/index.js
@@ -36,14 +36,23 @@ module.exports = function (mains, opts) {
     var pushResult = (function () {
         var slots = {};
         var upto = 0;
+        var offset = 0;
         
         return function (row, order) {
+            if (row && opts.includeIndex) {
+                row.index = order - offset;
+            }
+            
             if (order === upto) {
-                if (row !== false) output.queue(row);
+                if (row === false) offset ++;
+                else output.queue(row);
+                
                 for (upto ++; slots[upto] !== undefined; upto++) {
-                    if (slots[upto] !== false) {
-                        output.queue(slots[upto]);
+                    if (slots[upto] === false) {
+                        offset ++
                     }
+                    else output.queue(slots[upto]);
+                    
                     delete slots[upto];
                 }
             }

-- 
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