mirror of
https://github.com/cp6/my-idlers.git
synced 2025-04-20 18:18:36 +00:00
24 lines
No EOL
407 B
Markdown
24 lines
No EOL
407 B
Markdown
# `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) |