UNPKG

ng-annotate-patched

Version:

add, remove and rebuild angularjs dependency injection annotations

10 lines (7 loc) 271 B
function stableSort(arr, compareFn) { return arr.map((value, index) => [value, index]).sort(([a, ai], [b, bi]) => { const cmp = compareFn(a, b); return cmp === 0 ? ai - bi : cmp; }).map(([value, _]) => value); } module.exports = { stableSort };