Arranges values in an order.
npm install @extra-array/insertion-sort-updateArranges values in an order. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]
> Similar: [sort], [merge].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.insertionSort$(x, [fc], [fm]);
// x: an array (updated)
// fc: compare function (a, b)
// fm: map function (v, i, x)
// --> x
`javascript
const array = require('extra-array');
var x = [-2, -3, 1, 4];
array.insertionSort$(x);
// [ -3, -2, 1, 4 ] (compares numbers)
x;
// [ -3, -2, 1, 4 ]
var x = [-2, -3, 1, 4];
array.insertionSort$(x, (a, b) => Math.abs(a) - Math.abs(b));
// [ 1, -2, -3, 4 ]
var x = [-2, -3, 1, 4];
array.insertionSort$(x, null, v => Math.abs(v));
// [ 1, -2, -3, 4 ]
``
- Data.Sort.sortBy: Haskell
- Array.prototype.sort: MDN web docs
- Bubble Sort: Wikipedia
- bubble-sort: @tristanls
- algo-sort-bubble: @bredele
- bubblesort: @addyosmani
- sort-bubble: @lukebro
- bubble-sort-js: @JacopoDaeli
- bubble-srt: @abranhe
- b-sort: alkuhar
- @clarketm/superbubblesort: @clarketm
- sort-algorithms-js: @eyas-ranjous
- sort-types: @dalalayan1
- sorting-helpers: @AntoniAngga
- sorti: @nadavgld
- sortie: @mustafar
- sorting: @lakhaNamdhari
- plentiful: @ajnauleau
- sort-all-in-one: @OnlyRefat
- sort-algorithms: @sombrerolgringo
- sorting-algorithms: @luongnv89
- js-sorting: @jasonheecs
- js-sorting-algo: @kumar-gaurav-mishra
- @ds-javascript/sort: @opensourcedj217
- best-sort: @agniswarm
[sort]: https://github.com/nodef/extra-array/wiki/sort
[sort$]: https://github.com/nodef/extra-array/wiki/sort$
[merge]: https://github.com/nodef/extra-array/wiki/merge
[:running:]: https://npm.runkit.com/@extra-array/insertion-sort-update
[:vhs:]: https://asciinema.org/a/334733
[:package:]: https://www.npmjs.com/package/@extra-array/insertion-sort-update
[:moon:]: https://www.npmjs.com/package/@extra-array/insertion-sort-update.min
[:ledger:]: https://unpkg.com/@extra-array/insertion-sort-update/