source: node_modules/es-toolkit/dist/compat/string/startsWith.d.ts@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 960 bytes
Line 
1/**
2 * Checks if a string contains another string at the beginning of the string.
3 *
4 * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.
5 *
6 * @param {string} str - The string that might contain the target string.
7 * @param {string} target - The string to search for.
8 * @param {number} position - An optional offset to start searching in the str string
9 * @returns {boolean} - True if the str string starts with the target string.
10 *
11 * @example
12 * const isPrefix = startsWith('fooBar', 'foo') // returns true
13 * const isPrefix = startsWith('fooBar', 'bar') // returns false
14 * const isPrefix = startsWith('fooBar', 'abc') // returns false
15 * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true
16 * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false
17 */
18declare function startsWith(str?: string, target?: string, position?: number): boolean;
19
20export { startsWith };
Note: See TracBrowser for help on using the repository browser.