Skip to content

Commit

Permalink
Improve sort example
Browse files Browse the repository at this point in the history
  • Loading branch information
samselikoff committed Oct 5, 2020
1 parent d81a6b7 commit ac2727a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/orm/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ export default class Collection {
Returns a new Collection with its models sorted according to the provided [compare function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
```js
let postsByTitleAsc = user.posts.sort((a, b) => {
return b.title < a.title;
});
let postsByTitleAsc = user.posts.sort((a, b) => a.title > b.title ? 1 : -1 );
```
@method sort
Expand Down

0 comments on commit ac2727a

Please sign in to comment.