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