Last updated 4 years ago
Evaluates whether the defined value equals at least one of the elements of the given array. If a string is provided instead, it makes sure that value is its sub-string.
contains :: a → [ b ] → Boolean
import contains from 'deep-waters/contains'; // works both with primitives const isSubstring = contains('pre'); isSubstring('pre-something'); // → true isSubstring('foo'); // → false // or plain and nested objects const containsObj = contains({ foo: 'bar', deep: { bar: 'foo' } }); containsObj([1, 2, 3, 'str', { foo: 'bar', deep: { bar: 'foo' } }]); // → true;