|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
635 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | import { trim as trim$1 } from '../../string/trim.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function trim(str, chars, guard) {
|
|---|
| 4 | if (str == null) {
|
|---|
| 5 | return '';
|
|---|
| 6 | }
|
|---|
| 7 | if (guard != null || chars == null) {
|
|---|
| 8 | return str.toString().trim();
|
|---|
| 9 | }
|
|---|
| 10 | switch (typeof chars) {
|
|---|
| 11 | case 'object': {
|
|---|
| 12 | if (Array.isArray(chars)) {
|
|---|
| 13 | return trim$1(str, chars.flatMap(x => x.toString().split('')));
|
|---|
| 14 | }
|
|---|
| 15 | else {
|
|---|
| 16 | return trim$1(str, chars.toString().split(''));
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 | default: {
|
|---|
| 20 | return trim$1(str, chars.toString().split(''));
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | export { trim };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.