Verifies that the needle is contained in value
Install
Install all functions of strman
yarn add strman
or just the contains function
yarn add strman.contains
Usage
import { contains } from 'strman'
// OR
import contains from 'strman.contains'
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
String | The input string |
||
needle |
String | The string which is checked to be contained within |
||
caseSensitive |
Boolean |
<optional> |
true | Use case (in-)sensitive matching |
- Source:
Returns:
True if needle
is contained
- Type
- Boolean
Example
const title = 'Daniel Leite'
const needle = 'leite'
contains(title, needle, false)
// => true