UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

23 lines (22 loc) 892 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const baseIndexOf_1 = __importDefault(require("./baseIndexOf")); /** * 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 && (0, baseIndexOf_1.default)(chrSymbols, strSymbols[index], 0) > -1) { } return index; } exports.default = charsStartIndex;