|
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:
654 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | function trimStart(str, chars) {
|
|---|
| 6 | if (chars === undefined) {
|
|---|
| 7 | return str.trimStart();
|
|---|
| 8 | }
|
|---|
| 9 | let startIndex = 0;
|
|---|
| 10 | switch (typeof chars) {
|
|---|
| 11 | case 'string': {
|
|---|
| 12 | while (startIndex < str.length && str[startIndex] === chars) {
|
|---|
| 13 | startIndex++;
|
|---|
| 14 | }
|
|---|
| 15 | break;
|
|---|
| 16 | }
|
|---|
| 17 | case 'object': {
|
|---|
| 18 | while (startIndex < str.length && chars.includes(str[startIndex])) {
|
|---|
| 19 | startIndex++;
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 | return str.substring(startIndex);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | exports.trimStart = trimStart;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.