MCPcopy
hub / github.com/autoNumeric/autoNumeric / contains

Method contains

src/AutoNumericHelper.js:208–215  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 13

isNegativeMethod · 0.95
scientificToDecimalMethod · 0.95
validateMethod · 0.80
_initialCaretPositionMethod · 0.80
_roundCloseTo05Method · 0.80
_onPasteMethod · 0.80
_normalizePartsMethod · 0.80

Calls 1

isStringMethod · 0.95

Tested by

no test coverage detected