my-idlers/node_modules/collect.js/docs/api/sortKeys.md
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

412 B

sortKeys()

The sortKeys method sorts the collection by the keys of the underlying associative array:

const collection = collect({
  id: 10,
  first: 'Sadio',
  last: 'Mané',
});

const sorted = collection.sortKeys();

sorted.all();

// {
//   first: 'Sadio',
//   id: 10,
//   last: 'Mané',
// }

View source on GitHub