Skip to Content

sortBy()

Sorts an array of objects by one or more properties.

Each entry in sortProperties is a string in the format 'property:order' where order is 'asc' or 'desc'. Supports dot-notation for nested properties.

Kind: global function
Returns: Array.<Object> - A new sorted array.

ParamTypeDescription
objectsArray.<Object>The array to sort.
sortPropertiesArray.<string>Sort descriptors in 'property:order' format.

Example

ARM.sortBy(addresses, ['attributes.city:asc', 'id:desc'])
Last updated on