* Return `true` is the string `str` contains the string `needle` * Note: this function does not coerce the parameters types * * @param {string} str * @param {string} needle * @returns {boolean}
(str, needle)
| 206 | * @returns {boolean} |
| 207 | */ |
| 208 | static contains(str, needle) { |
| 209 | //TODO Use `Array.prototype.includes()` when available (cf. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) |
| 210 | if (!this.isString(str) || !this.isString(needle) || str === '' || needle === '') { |
| 211 | return false; |
| 212 | } |
| 213 | |
| 214 | return str.indexOf(needle) !== -1; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Return `true` if the `needle` is in the array |
no test coverage detected