Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 3048e3e

Browse files
hugomrdiasvmx
authored andcommitted
fix: native sort is stable now
1 parent 98d9ac6 commit 3048e3e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dag-node/sortLinks.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
'use strict'
22

3-
const sort = require('stable')
43
const { Buffer } = require('buffer')
54

65
const linkSort = (a, b) => {
76
return Buffer.compare(a.nameAsBuffer, b.nameAsBuffer)
87
}
98

9+
/**
10+
*
11+
* @param {Array} links
12+
* @returns {Array}
13+
*/
1014
const sortLinks = (links) => {
11-
return sort(links, linkSort)
15+
return links.sort(linkSort)
1216
}
1317

1418
module.exports = sortLinks

0 commit comments

Comments
 (0)