[Pkg-javascript-commits] [node-deps-sort] 10/79: Deterministic sort for bundles with same id

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:41:52 UTC 2017


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

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

commit e49216c85b00e0663a48ba45bee7d1def51c543c
Author: Bob Lauer <rlauer at gmail.com>
Date:   Tue May 6 08:59:23 2014 -0400

    Deterministic sort for bundles with same id
---
 index.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index 60efa8c..ca07777 100644
--- a/index.js
+++ b/index.js
@@ -2,16 +2,16 @@ var through = require('through');
 
 module.exports = function (opts) {
     if (!opts) opts = {};
-    
+
     var rows = [];
     return through(write, end);
-    
+
     function write (row) { rows.push(row) }
-    
+
     function end () {
         var tr = this;
         rows.sort(cmp);
-        
+
         if (opts.index) {
             var index = {};
             rows.forEach(function (row, ix) {
@@ -33,8 +33,8 @@ module.exports = function (opts) {
         }
         tr.queue(null);
     }
-    
+
     function cmp (a, b) {
-        return a.id < b.id ? -1 : 1;
+        return a.id + a.hash < b.id + b.hash ? -1 : 1;
     }
 };

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



More information about the Pkg-javascript-commits mailing list