Skip to content

make-github-pseudonymous-again/js-sorting

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sorting code bricks for JavaScript. Parent is aureooms/js-algo.

let fordjohnson = sort._fordjohnson( search.binarysearch ) ;

NPM license NPM version Bower version Build Status Coverage Status Dependencies Status devDependencies Status Code Climate NPM downloads per month GitHub issues Inline docs

Can be managed through jspm, duo, component, bower, ender, jam, spm, and npm.

Install

jspm

jspm install github:aureooms/js-sort
# or
jspm install npm:aureooms-js-sort

duo

No install step needed for duo!

component

component install aureooms/js-sort

bower

bower install aureooms-js-sort

ender

ender add aureooms-js-sort

jam

jam install aureooms-js-sort

spm

spm install aureooms-js-sort --save

npm

npm install aureooms-js-sort --save

Require

jspm

let sort = require( "github:aureooms/js-sort" ) ;
// or
import sort from 'aureooms-js-sort' ;

duo

let sort = require( "aureooms/js-sort" ) ;

component, ender, spm, npm

let sort = require( "aureooms-js-sort" ) ;

bower

The script tag exposes the global variable sort.

<script src="bower_components/aureooms-js-sort/js/dist/sort.min.js"></script>

Alternatively, you can use any tool mentioned here.

jam

require( [ "aureooms-js-sort" ] , function ( sort ) { ... } ) ;

Children

This package has several children:

Use

let array = require( "aureooms-js-array" ) ;
let search = require( "aureooms-js-search" ) ;
let compare = require( "aureooms-js-compare" ) ;

let fordjohnson = function ( compare , a , i , j ) {

	sort._fordjohnson( search.binarysearch )( compare , array.swap , a , i , j ) ;

} ;

let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;

fordjohnson( compare.increasing , a , 0 , a.length ) ;

a ; // [ 1 , 2 , 3 , 4 , 5 , 6 ]

fordjohnson( compare.decreasing , a , 0 , a.length ) ;

a ; // [ 6 , 5 , 4 , 3 , 2 , 1 ]

// but also

/** insertionsort */
let insertionsort = sort.insertionsort ;
/** selectionsort */
let selectionsort = sort.selectionsort ;
/** bubblesort */
let bubblesort = sort.bubblesort ;

Reference