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.

23 lines
407 B

4 years ago
  1. # `has()`
  2. The has method determines if one or more keys exists in the collection:
  3. ```js
  4. const collection = collect({
  5. animal: 'unicorn',
  6. ability: 'magical',
  7. });
  8. collection.has('ability');
  9. // true
  10. collection.has(['animal', 'ability']);
  11. // true
  12. collection.has(['animal', 'ability', 'name']);
  13. // false
  14. ```
  15. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/has.js)