source: node_modules/es-toolkit/dist/compat/string/endsWith.d.ts@ ba17441

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

Added visualizations

  • Property mode set to 100644
File size: 946 bytes
Line 
1/**
2 * Checks if a string contains another string at the end of the string.
3 *
4 * Checks if one string endsWith another string. Optional position parameter to offset searching before 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 position from the start to search up to this index
9 * @returns {boolean} - True if the str string ends with the target string.
10 *
11 * @example
12 * const isPrefix = endsWith('fooBar', 'foo') // returns true
13 * const isPrefix = endsWith('fooBar', 'bar') // returns false
14 * const isPrefix = endsWith('fooBar', 'abc') // returns false
15 * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true
16 * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false
17 */
18declare function endsWith(str?: string, target?: string, position?: number): boolean;
19
20export { endsWith };
Note: See TracBrowser for help on using the repository browser.