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.

20 lines
380 B

4 years ago
  1. # `flip()`
  2. The flip method swaps the collection's keys with their corresponding values:
  3. ```js
  4. const collection = collect({
  5. name: 'Steven Gerrard',
  6. number: 8,
  7. });
  8. const flipped = collection.flip();
  9. flipped.all();
  10. // {
  11. // 'Steven Gerrard': 'name',
  12. // '8': 'number',
  13. // }
  14. ```
  15. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/flip.js)