source: node_modules/es-toolkit/dist/string/trimStart.mjs@ 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: 556 bytes
Line 
1function trimStart(str, chars) {
2 if (chars === undefined) {
3 return str.trimStart();
4 }
5 let startIndex = 0;
6 switch (typeof chars) {
7 case 'string': {
8 while (startIndex < str.length && str[startIndex] === chars) {
9 startIndex++;
10 }
11 break;
12 }
13 case 'object': {
14 while (startIndex < str.length && chars.includes(str[startIndex])) {
15 startIndex++;
16 }
17 }
18 }
19 return str.substring(startIndex);
20}
21
22export { trimStart };
Note: See TracBrowser for help on using the repository browser.