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.

24 lines
625 B

4 years ago
  1. # `whereBetween()`
  2. The whereBetween method filters the collection within a given range:
  3. ```js
  4. const collection = collect([
  5. { product: 'Desk', price: 200 },
  6. { product: 'Chair', price: 80 },
  7. { product: 'Bookcase', price: 150 },
  8. { product: 'Pencil', price: 30 },
  9. { product: 'Door', price: 100 },
  10. ]);
  11. const filtered = collection.whereBetween('price', [100, 200]);
  12. filtered.all();
  13. // [
  14. // { product: 'Desk', price: 200 },
  15. // { product: 'Bookcase', price: 150 },
  16. // { product: 'Door', price: 100 },
  17. // ]
  18. ```
  19. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/whereBetween.js)