0.0.4 • Published 5 years ago

node-bubsort v0.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

node-bubsort

A node implementation of buble sort with user defined predicate function

npm install node-bubsort

Usage:

const bubble = require('node-bubsort');

const { result, count } = bubble.sort([2, 1, 3]);
// result => [1, 2, 3]
// count => 2. Count refers to the number of passes of sort.

// sort with a predicate function
    const { result, count } = bubble.sort([
        { key: 5 },
        { key: 1 },
        { key: 4 },
        { key: 2 },
        { key: 8 }
    ], (objOne, objTwo) => objOne.key > objTwo.key);

// result => [ { key: 1 }, { key: 2 }, { key: 4 }, { key: 5 }, { key: 8 }]
// count => 3
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago