basant307/AI_Governance_Project
045
1var baseClamp = require('./_baseClamp'),2 baseToString = require('./_baseToString'),3 toInteger = require('./toInteger'),4 toString = require('./toString');5 6/**7 * Checks if `string` starts with the given target string.8 *9 * @static10 * @memberOf _11 * @since 3.0.012 * @category String13 * @param {string} [string=''] The string to inspect.14 * @param {string} [target] The string to search for.15 * @param {number} [position=0] The position to search from.16 * @returns {boolean} Returns `true` if `string` starts with `target`,17 * else `false`.18 * @example19 *20 * _.startsWith('abc', 'a');21 * // => true22 *23 * _.startsWith('abc', 'b');24 * // => false25 *26 * _.startsWith('abc', 'b', 1);27 * // => true28 */29function startsWith(string, target, position) {30 string = toString(string);31 position = position == null32 ? 033 : baseClamp(toInteger(position), 0, string.length);34 35 target = baseToString(target);36 return string.slice(position, position + target.length) == target;37}38 39module.exports = startsWith;40 