.has()

Checks if there is any entry matching the provided filter.

has(filter)

Parameter

Description

filter

Callback

Function to test each element of the array. Return a value that coerces to true to keep the element, or to false otherwise

Returns

Description

Whether or not there is any entry matching the provided filter

// Note: Users is a collection.

Users.getAll(); // [{ id: 1, name: '5antos' }]

Users.has(u => u.name === '5antos'); // true
Users.has(u => u.id === 2); // false

Last updated