set.includes()

Test if the Set includes a provided element.

Signature

includes(element: A) => Boolean

Description

Tests if the Set includes a provided element.

Eager loading

This method uses eager loading and requires a read of each document in the calling Set. For large Sets, this may result in poor performance and high costs.

Parameters

Parameter Type Required Description

element

Generic

Yes

Element to check the Set for.

Return value

Type Description

Boolean

If true, the Set contains the provided element. Otherwise, false.

Examples

// `toSet()` converts an Array to a Set.
let set = [1, 2, 3].toSet()
set.includes(2)
true

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!