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
407 B
24 lines
407 B
4 years ago
|
# `has()`
|
||
|
|
||
|
The has method determines if one or more keys exists in the collection:
|
||
|
|
||
|
```js
|
||
|
const collection = collect({
|
||
|
animal: 'unicorn',
|
||
|
ability: 'magical',
|
||
|
});
|
||
|
|
||
|
collection.has('ability');
|
||
|
|
||
|
// true
|
||
|
|
||
|
collection.has(['animal', 'ability']);
|
||
|
|
||
|
// true
|
||
|
|
||
|
collection.has(['animal', 'ability', 'name']);
|
||
|
|
||
|
// false
|
||
|
```
|
||
|
|
||
|
[View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/has.js)
|