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.

21 lines
453 B

4 years ago
  1. # `whereInstanceOf()`
  2. The whereInstanceOf method filters the collection by a given class type:
  3. ```js
  4. const collection = collect([
  5. new Player('Firmino'),
  6. new Player('Salah'),
  7. new Manager('Klopp'),
  8. ]);
  9. const filtered = collection.whereInstanceOf(Player);
  10. filtered.all();
  11. // [
  12. // new Player('Firmino'),
  13. // new Player('Salah'),
  14. // ]
  15. ```
  16. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/whereInstanceOf.js)