1.0.0 • Published 2 years ago
sort-object-array-by-property v1.0.0
Sort array by object-property
Order arrays of objects by passed object-property
$ npm i sort-object-array-by-property
Example
Pass callback function into Javascipt's sort-function like:
const sortObjectArrayByProperty = require('sort-object-array-by-property')
const objectArray = [{
name: "Adam",
age: 34
}, {
name: "Berta",
age: 33
}, {
name: "Carlos",
age: 30
}];
console.log(objectArray.sort(sortObjectArrayByProperty('name')))
1.0.0
2 years ago