Files
lodash/_charsStartIndex.js
2017-01-09 17:38:33 -08:00

21 lines
632 B
JavaScript

import baseIndexOf from './_baseIndexOf.js';
/**
* Used by `trim` and `trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
let index = -1;
const length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
export default charsStartIndex;