sort-insertion

1.1.0 • Public • Published

sort-insertion

Insertion sort for arrays.

Returns a sorted array, original array stays untouched.

example

import sort from 'sort-insertion'

sort([6, 2, 5, 3], function (a, b) {
	return a > b
}) // returns [2, 3, 5, 6]

sort(['hello', 'how', 'are', 'you', '?'], function (a, b) {
	return a.length > b.length
}) // returns ['?', 'how', 'are', 'you', 'hello']

Package Sidebar

Install

npm i sort-insertion

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

2.67 kB

Total Files

4

Last publish

Collaborators

  • lukebro