You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
412 B

4 years ago
  1. # `sortKeys()`
  2. The sortKeys method sorts the collection by the keys of the underlying associative array:
  3. ```js
  4. const collection = collect({
  5. id: 10,
  6. first: 'Sadio',
  7. last: 'Mané',
  8. });
  9. const sorted = collection.sortKeys();
  10. sorted.all();
  11. // {
  12. // first: 'Sadio',
  13. // id: 10,
  14. // last: 'Mané',
  15. // }
  16. ```
  17. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/sortKeys.js)