sort-multidimensional-array-func
v1.0.1
Published
multidimensional array sorting function
Downloads
7
Readme
sort-multidimensional-array-func
multidimensional array sorting function
Install
npm install --save sort-multidimensional-array-func
Usage
import sortMultidimensionalArrayFunc from 'sort-multidimensional-array-func';
const arr = [
[123, 345, 545],
[456, 564, 345],
[12, 3, 4]
]
console.log(sortMultidimensionalArrayFunc(arr, 1, 'asc'))
// [[12, 3, 4], [123, 345, 545], [456, 564, 345]]
console.log(sortMultidimensionalArrayFunc(arr, 1, 'desc'))
// [[456, 564, 345], [123, 345, 545], [12, 3, 4]]
console.log(sortMultidimensionalArrayFunc(arr, 2, 'desc'))
// [[123, 345, 545], [456, 564, 345], [12, 3, 4]]