Skip to content

A node module who does recursive quick sort over a nested array.

License

Notifications You must be signed in to change notification settings

Maples7/deep-qsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deep-qsort

Build Status Coverage Status npm version
NPM NPM

A node module who does recursive quick sort over a nested array.

Usage

Installation

npm i deep-qsort --save

Example

const deepSort = require('deep-qsort');

const ret = deepSort([4, 3, [25, 3, [9], [-1, 0], 24], 2, 13, 11, -9]);
// output: 
// [ -9, 2, 3, 4, 11, 13, [ 3, 24, 25, [ -1, 0 ], [ 9 ] ] ]
console.log(ret); 

API

deepSort(
  // Array wait to be sorted
  arr,
  // A tiny question in this problem is where we 
  // put deep arrays —— at the beginning or the end. 
  // With this param, you have choice. It means 
  // that when an array is compared with other non-array 
  // items, whether the array is always bigger. 
  // Default to `true`
  arrayIsBigger = true 
)

LICENSE

MIT

About

A node module who does recursive quick sort over a nested array.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published