Verifies that one or more of needles are contained in value
Install
Install all functions of strman
yarn add strman
or just the containsAny function
yarn add strman.containsany
Usage
import { containsAny } from 'strman'
// OR
import containsAny from 'strman.containsany'
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
String | The input string |
||
needles |
Array.<String> | An array of string which are checked to be contained within |
||
caseSensitive |
Boolean |
<optional> |
true | Use case (in-)sensitive matching |
- Source:
Returns:
True if at least one of needles
is contained
- Type
- Boolean
Example
const title = 'Daniel Leite'
const needles = ['Leite', 'Oliveira']
containsAny(title, needles)
// => true