npm.io
1.1.0 • Published 7 years ago

sort-bubble

Licence
MIT
Version
1.1.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
1

sort-bubble

Bubble sort for arrays.

Returns a sorted array, original array stays untouched.

example

import sort from 'sort-bubble'

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']

Keywords