Sort an object by key or value
npm i object-to-sorted-array
import sortObj from 'object-to-sorted-array';
sortObj(object);
sortObj(object[, sortBy])
sortObj(object[, sortBy[, sortOrder]])
-
object
- object to de sorted
-
sortBy
(optional)
- "key" | "value"
- sort by the objects keys or values
-
order
(optional)
- "ascending" | "descending"
- sort in ascending or descending order
- Returns an array of sorted key/value pair arrays
[['key', 'value'], ...]
Distributed under the MIT License. See LICENSE
for more information.
Project Link: https://github.com/michael-joseph-miller/object-prototype-sort