Skip to content

v0.34.1

Compare
Choose a tag to compare
@kiaking kiaking released this 26 Nov 14:53
· 194 commits to master since this release

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! 🎉

Fixes

  • #344 Fixed where lifecycle hook defined at model was not bound to the model object.
  • #504 Fixed where first and last method was returning undefined instead of null when data is empty.