1.0.4 • Published 10 years ago

grin v1.0.4

Weekly downloads
2
License
Apache 2
Repository
github
Last release
10 years ago

grin

Build Status

Simple non-recursive implementation of merge sort. Originally based on this Java implementation, by @nolanlawson now mostly written by @calvinmetcalf.

Status, should work, does modify the array in place, will not work on sparse arrays exactly like native but that's ok.

Usage

$ npm install grin

Then in code:

var sort = require('grin');
var arr = [3, 2, 1, 4, 10];

// [1, 10, 2, 3, 4]
var sortedNaturally = sort(arr);

// [1, 2, 3, 4, 10]
var sortedNumerically = sort(arr, function (a, b) { return a - b; });

Testing

Unit tests:

$ npm test

Coverage tests:

$ npm run coverage
1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago