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.

28 lines
530 B

4 years ago
  1. # `except()`
  2. The except method returns all items in the collection except for those with the specified keys:
  3. ```js
  4. const collection = collect({
  5. product_id: 1,
  6. price: 100,
  7. discount: false,
  8. });
  9. const filtered = collection.except(['price', 'discount']);
  10. filtered.all();
  11. // { product_id: 1 }
  12. ```
  13. ```js
  14. collect([1, 2, 3, 4])
  15. .except([2, 12])
  16. .all();
  17. // [1, 3, 4]
  18. ```
  19. > For the inverse of `except`, see the `only` method.
  20. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/except.js)