sort-obj
Sort the keys and values of an object.
Install
npm install sort-obj
Usage
const sortObject = ;const numberSort = ;const alphaSort = ; ;//=> { a: 1, b: 3, c: 2 } ;//=> { a: 1, c: 2, b: 3 } sortObject;//=> { a: 1, b: 3, c: 2 } sortObject;//=> { a: 1, c: 2, b: 3 }
API
sortObject(input, mapper)
Sort an object by its keys and values.
sortObject.keys(input, mapper)
Sort an object by its keys.
sortObject.values(input, mapper)
Sort an object by its values.
input
Type: object
The object to sort.
mapper
Type: function