v0.34.1
Improvements
Passing a function to the 1st argument of orderBy method.
Now you can pass a function as the 1st argument of orderBy
. The function will accept a record that is being sorted, and it should return value to be sorted by.
// Sort user name by its 3rd character.
const users = User.query().orderBy(user => user.name[2]).get()
/*
[
{ id: 4, name: 'Andy' },
{ id: 2, name: 'Roger' },
{ id: 1, name: 'John' }
]
*/
Thanks to @leearaneta for this wonderful PR! 🎉