Files
2025-12-03 21:28:08 +00:00

383 B
Executable File

flip()

The flip method swaps the collection's keys with their corresponding values:

const collection = collect({
  name: 'Darwin Núñez',
  number: 27,
});

const flipped = collection.flip();

flipped.all();

// {
//   'Darwin Núñez': 'name',
//   '27': 'number',
// }

View source on GitHub