Files
ihrm/node_modules/collect.js/docs/api/sortKeys.md

24 lines
442 B
Markdown
Raw Normal View History

2023-05-10 15:06:57 +05:30
# `sortKeys()`
The sortKeys method sorts the collection by the keys of the underlying associative array:
```js
const collection = collect({
id: 10,
first: 'Darwin',
last: 'Núñez',
});
const sorted = collection.sortKeys();
sorted.all();
// {
// first: 'Darwin',
// id: 10,
// last: 'Núñez',
// }
```
[View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/sortKeys.js)