sort-array-open
v1.0.1
Published
Use this package to sort an array in ascending or descending order.
Downloads
1
Readme
#sort-array-open package
Use this package to sort an array in ascending or descending order.
The package contains three functions:
- removeFalsy
- sortAsc
- sortDesc
#removeFalsy
Use this function to remove any falsy values such as null and undefined.
Example: removeFalsy([1, 4, 2, , 4, null, 0, 3]) Result: [ 1, 4, 2, 4, 0, 3 ]
#sortAsc
Use this function to sort an array in ascending order (it will remove all falsy values in the result).
Example: sortAsc([1, 4, 2, , 4, null, 00, 3]) Result: [ 0, 1, 2, 3, 4, 4 ]
#sortDesc
Use this function to sort an array in descending order (it will remove all falsy values result).
Example: sortDesc([1, 4, 2, , 4, null, 00, 3]) Result: [ 4, 4, 3, 2, 1, 0 ]