@etsoo/shared 1.0.57 → 1.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/__tests__/DomUtils.ts +11 -1
- package/__tests__/Utils.ts +13 -5
- package/lib/cjs/DomUtils.js +1 -3
- package/lib/cjs/Utils.d.ts +30 -6
- package/lib/cjs/Utils.js +31 -15
- package/lib/mjs/DomUtils.js +1 -3
- package/lib/mjs/Utils.d.ts +30 -6
- package/lib/mjs/Utils.js +31 -15
- package/package.json +6 -1
- package/src/DomUtils.ts +3 -3
- package/src/Utils.ts +64 -12
package/README.md
CHANGED
|
@@ -124,8 +124,8 @@ String and other related utilities
|
|
|
124
124
|
|
|
125
125
|
|Name|Description|
|
|
126
126
|
|---:|---|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
127
|
+
|formatInitial|Format inital character to lower case or upper case|
|
|
128
|
+
|formatString|Format string with parameters|
|
|
129
129
|
|getDataChanges|Get data changed fields with input data updated|
|
|
130
130
|
|getTimeZone|Get time zone|
|
|
131
131
|
|joinItems|Join items as a string|
|
package/__tests__/DomUtils.ts
CHANGED
|
@@ -133,17 +133,27 @@ test('Tests for dataAs', () => {
|
|
|
133
133
|
formData.append('price', '34.25');
|
|
134
134
|
formData.append('options', '1,2,3,4');
|
|
135
135
|
formData.append('memo', 'Memo');
|
|
136
|
+
formData.append('email', 'a@b');
|
|
137
|
+
formData.append('email', 'c@d');
|
|
138
|
+
formData.append('code', '123');
|
|
139
|
+
formData.append('code', '456');
|
|
136
140
|
|
|
137
141
|
const data = DomUtils.dataAs(formData, {
|
|
138
142
|
id: 'number',
|
|
139
143
|
name: 'string',
|
|
140
144
|
price: 'number',
|
|
141
|
-
options: 'number[]'
|
|
145
|
+
options: 'number[]',
|
|
146
|
+
email: 'string[]',
|
|
147
|
+
code: 'number[]'
|
|
142
148
|
});
|
|
143
149
|
|
|
144
150
|
expect(data.id).toStrictEqual(1234);
|
|
145
151
|
expect(data.options?.length).toStrictEqual(4);
|
|
146
152
|
expect(data.options![0]).toStrictEqual(1);
|
|
153
|
+
|
|
154
|
+
expect(data.email).toEqual(['a@b', 'c@d']);
|
|
155
|
+
expect(data.code?.length).toStrictEqual(2);
|
|
156
|
+
expect(data.code).toEqual([123, 456]);
|
|
147
157
|
expect(data).not.toHaveProperty('memo', 'Memo');
|
|
148
158
|
|
|
149
159
|
const keepSourceData = DomUtils.dataAs(
|
package/__tests__/Utils.ts
CHANGED
|
@@ -23,12 +23,17 @@ test('Tests for getDataChanges', () => {
|
|
|
23
23
|
expect(input.amount).toBeUndefined();
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
test('Tests for
|
|
27
|
-
expect(Utils.
|
|
26
|
+
test('Tests for formatInitial', () => {
|
|
27
|
+
expect(Utils.formatInitial('HelloWorld')).toBe('helloWorld');
|
|
28
|
+
expect('HelloWorld'.formatInitial(false)).toBe('helloWorld');
|
|
29
|
+
expect('hello'.formatInitial(true)).toBe('Hello');
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
test('Tests for
|
|
31
|
-
|
|
32
|
+
test('Tests for formatString', () => {
|
|
33
|
+
const template = '{0} is first item, {1} is second item, {0} repeat';
|
|
34
|
+
const result = 'aa is first item, bb is second item, aa repeat';
|
|
35
|
+
expect(Utils.formatString(template, 'aa', 'bb')).toBe(result);
|
|
36
|
+
expect(template.format('aa', 'bb')).toBe(result);
|
|
32
37
|
});
|
|
33
38
|
|
|
34
39
|
test('Tests for joinItems', () => {
|
|
@@ -48,7 +53,10 @@ test('Tests for newGUID', () => {
|
|
|
48
53
|
});
|
|
49
54
|
|
|
50
55
|
test('Tests for removeNonLetters', () => {
|
|
51
|
-
|
|
56
|
+
const input = '1234-5678@abc.';
|
|
57
|
+
const result = '12345678abc';
|
|
58
|
+
expect(Utils.removeNonLetters(input)).toBe(result);
|
|
59
|
+
expect(input.removeNonLetters()).toBe(result);
|
|
52
60
|
});
|
|
53
61
|
|
|
54
62
|
test('Tests for objectEqual', () => {
|
package/lib/cjs/DomUtils.js
CHANGED
|
@@ -94,9 +94,7 @@ var DomUtils;
|
|
|
94
94
|
// Properties
|
|
95
95
|
const properties = Object.keys(template);
|
|
96
96
|
// Entries
|
|
97
|
-
const entries = isFormData(source)
|
|
98
|
-
? source.entries()
|
|
99
|
-
: Object.entries(source);
|
|
97
|
+
const entries = Object.entries(isFormData(source) ? formDataToObject(source) : source);
|
|
100
98
|
for (const [key, value] of entries) {
|
|
101
99
|
// Is included or keepSource
|
|
102
100
|
const property = (_a = properties.find((p) => p.localeCompare(key, 'en', { sensitivity: 'base' }) ===
|
package/lib/cjs/Utils.d.ts
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import { DataTypes } from './DataTypes';
|
|
2
|
+
declare global {
|
|
3
|
+
interface String {
|
|
4
|
+
/**
|
|
5
|
+
* Format string
|
|
6
|
+
* @param this Template
|
|
7
|
+
* @param parameters Parameters to fill the template
|
|
8
|
+
*/
|
|
9
|
+
format(this: string, ...parameters: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Forat inital character
|
|
12
|
+
* @param this Input string
|
|
13
|
+
* @param upperCase To upper case or lower case
|
|
14
|
+
*/
|
|
15
|
+
formatInitial(this: string, upperCase: boolean): string;
|
|
16
|
+
/**
|
|
17
|
+
* Remove non letters (0-9, a-z, A-Z)
|
|
18
|
+
* @param this Input string
|
|
19
|
+
*/
|
|
20
|
+
removeNonLetters(this: string): string;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
2
23
|
/**
|
|
3
24
|
* Utilities
|
|
4
25
|
*/
|
|
5
26
|
export declare namespace Utils {
|
|
6
27
|
/**
|
|
7
|
-
* Format
|
|
8
|
-
* @param
|
|
28
|
+
* Format inital character to lower case or upper case
|
|
29
|
+
* @param input Input string
|
|
30
|
+
* @param upperCase To upper case or lower case
|
|
9
31
|
*/
|
|
10
|
-
function
|
|
32
|
+
function formatInitial(input: string, upperCase?: boolean): string;
|
|
11
33
|
/**
|
|
12
|
-
* Format
|
|
13
|
-
* @param
|
|
34
|
+
* Format string with parameters
|
|
35
|
+
* @param template Template with {0}, {1}, ...
|
|
36
|
+
* @param parameters Parameters to fill the template
|
|
37
|
+
* @returns Result
|
|
14
38
|
*/
|
|
15
|
-
function
|
|
39
|
+
function formatString(template: string, ...parameters: string[]): string;
|
|
16
40
|
/**
|
|
17
41
|
* Get data changed fields with input data updated
|
|
18
42
|
* @param input Input data
|
package/lib/cjs/Utils.js
CHANGED
|
@@ -2,27 +2,45 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Utils = void 0;
|
|
4
4
|
const DataTypes_1 = require("./DataTypes");
|
|
5
|
+
String.prototype.format = function (...parameters) {
|
|
6
|
+
let template = this;
|
|
7
|
+
parameters.forEach((value, index) => {
|
|
8
|
+
template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
|
|
9
|
+
});
|
|
10
|
+
return template;
|
|
11
|
+
};
|
|
12
|
+
String.prototype.formatInitial = function (upperCase = false) {
|
|
13
|
+
const initial = this.charAt(0);
|
|
14
|
+
return ((upperCase ? initial.toUpperCase() : initial.toLowerCase()) +
|
|
15
|
+
this.slice(1));
|
|
16
|
+
};
|
|
17
|
+
String.prototype.removeNonLetters = function () {
|
|
18
|
+
return this.replace(/[^a-zA-Z0-9]/g, '');
|
|
19
|
+
};
|
|
5
20
|
/**
|
|
6
21
|
* Utilities
|
|
7
22
|
*/
|
|
8
23
|
var Utils;
|
|
9
24
|
(function (Utils) {
|
|
10
25
|
/**
|
|
11
|
-
* Format
|
|
12
|
-
* @param
|
|
26
|
+
* Format inital character to lower case or upper case
|
|
27
|
+
* @param input Input string
|
|
28
|
+
* @param upperCase To upper case or lower case
|
|
13
29
|
*/
|
|
14
|
-
function
|
|
15
|
-
return
|
|
30
|
+
function formatInitial(input, upperCase = false) {
|
|
31
|
+
return input.formatInitial(upperCase);
|
|
16
32
|
}
|
|
17
|
-
Utils.
|
|
33
|
+
Utils.formatInitial = formatInitial;
|
|
18
34
|
/**
|
|
19
|
-
* Format
|
|
20
|
-
* @param
|
|
35
|
+
* Format string with parameters
|
|
36
|
+
* @param template Template with {0}, {1}, ...
|
|
37
|
+
* @param parameters Parameters to fill the template
|
|
38
|
+
* @returns Result
|
|
21
39
|
*/
|
|
22
|
-
function
|
|
23
|
-
return
|
|
40
|
+
function formatString(template, ...parameters) {
|
|
41
|
+
return template.format(...parameters);
|
|
24
42
|
}
|
|
25
|
-
Utils.
|
|
43
|
+
Utils.formatString = formatString;
|
|
26
44
|
/**
|
|
27
45
|
* Get data changed fields with input data updated
|
|
28
46
|
* @param input Input data
|
|
@@ -173,9 +191,7 @@ var Utils;
|
|
|
173
191
|
* @returns Result
|
|
174
192
|
*/
|
|
175
193
|
Utils.removeNonLetters = (input) => {
|
|
176
|
-
|
|
177
|
-
return input;
|
|
178
|
-
return input.replace(/[^a-zA-Z0-9]/g, '');
|
|
194
|
+
return input === null || input === void 0 ? void 0 : input.removeNonLetters();
|
|
179
195
|
};
|
|
180
196
|
/**
|
|
181
197
|
* Set source with new labels
|
|
@@ -206,9 +222,9 @@ var Utils;
|
|
|
206
222
|
Utils.snakeNameToWord = (name, firstOnly = false) => {
|
|
207
223
|
const items = name.split('_');
|
|
208
224
|
if (firstOnly) {
|
|
209
|
-
items[0] =
|
|
225
|
+
items[0] = items[0].formatInitial(true);
|
|
210
226
|
return items.join(' ');
|
|
211
227
|
}
|
|
212
|
-
return items.map((part) =>
|
|
228
|
+
return items.map((part) => part.formatInitial(true)).join(' ');
|
|
213
229
|
};
|
|
214
230
|
})(Utils = exports.Utils || (exports.Utils = {}));
|
package/lib/mjs/DomUtils.js
CHANGED
|
@@ -91,9 +91,7 @@ export var DomUtils;
|
|
|
91
91
|
// Properties
|
|
92
92
|
const properties = Object.keys(template);
|
|
93
93
|
// Entries
|
|
94
|
-
const entries = isFormData(source)
|
|
95
|
-
? source.entries()
|
|
96
|
-
: Object.entries(source);
|
|
94
|
+
const entries = Object.entries(isFormData(source) ? formDataToObject(source) : source);
|
|
97
95
|
for (const [key, value] of entries) {
|
|
98
96
|
// Is included or keepSource
|
|
99
97
|
const property = (_a = properties.find((p) => p.localeCompare(key, 'en', { sensitivity: 'base' }) ===
|
package/lib/mjs/Utils.d.ts
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import { DataTypes } from './DataTypes';
|
|
2
|
+
declare global {
|
|
3
|
+
interface String {
|
|
4
|
+
/**
|
|
5
|
+
* Format string
|
|
6
|
+
* @param this Template
|
|
7
|
+
* @param parameters Parameters to fill the template
|
|
8
|
+
*/
|
|
9
|
+
format(this: string, ...parameters: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Forat inital character
|
|
12
|
+
* @param this Input string
|
|
13
|
+
* @param upperCase To upper case or lower case
|
|
14
|
+
*/
|
|
15
|
+
formatInitial(this: string, upperCase: boolean): string;
|
|
16
|
+
/**
|
|
17
|
+
* Remove non letters (0-9, a-z, A-Z)
|
|
18
|
+
* @param this Input string
|
|
19
|
+
*/
|
|
20
|
+
removeNonLetters(this: string): string;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
2
23
|
/**
|
|
3
24
|
* Utilities
|
|
4
25
|
*/
|
|
5
26
|
export declare namespace Utils {
|
|
6
27
|
/**
|
|
7
|
-
* Format
|
|
8
|
-
* @param
|
|
28
|
+
* Format inital character to lower case or upper case
|
|
29
|
+
* @param input Input string
|
|
30
|
+
* @param upperCase To upper case or lower case
|
|
9
31
|
*/
|
|
10
|
-
function
|
|
32
|
+
function formatInitial(input: string, upperCase?: boolean): string;
|
|
11
33
|
/**
|
|
12
|
-
* Format
|
|
13
|
-
* @param
|
|
34
|
+
* Format string with parameters
|
|
35
|
+
* @param template Template with {0}, {1}, ...
|
|
36
|
+
* @param parameters Parameters to fill the template
|
|
37
|
+
* @returns Result
|
|
14
38
|
*/
|
|
15
|
-
function
|
|
39
|
+
function formatString(template: string, ...parameters: string[]): string;
|
|
16
40
|
/**
|
|
17
41
|
* Get data changed fields with input data updated
|
|
18
42
|
* @param input Input data
|
package/lib/mjs/Utils.js
CHANGED
|
@@ -1,25 +1,43 @@
|
|
|
1
1
|
import { DataTypes } from './DataTypes';
|
|
2
|
+
String.prototype.format = function (...parameters) {
|
|
3
|
+
let template = this;
|
|
4
|
+
parameters.forEach((value, index) => {
|
|
5
|
+
template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
|
|
6
|
+
});
|
|
7
|
+
return template;
|
|
8
|
+
};
|
|
9
|
+
String.prototype.formatInitial = function (upperCase = false) {
|
|
10
|
+
const initial = this.charAt(0);
|
|
11
|
+
return ((upperCase ? initial.toUpperCase() : initial.toLowerCase()) +
|
|
12
|
+
this.slice(1));
|
|
13
|
+
};
|
|
14
|
+
String.prototype.removeNonLetters = function () {
|
|
15
|
+
return this.replace(/[^a-zA-Z0-9]/g, '');
|
|
16
|
+
};
|
|
2
17
|
/**
|
|
3
18
|
* Utilities
|
|
4
19
|
*/
|
|
5
20
|
export var Utils;
|
|
6
21
|
(function (Utils) {
|
|
7
22
|
/**
|
|
8
|
-
* Format
|
|
9
|
-
* @param
|
|
23
|
+
* Format inital character to lower case or upper case
|
|
24
|
+
* @param input Input string
|
|
25
|
+
* @param upperCase To upper case or lower case
|
|
10
26
|
*/
|
|
11
|
-
function
|
|
12
|
-
return
|
|
27
|
+
function formatInitial(input, upperCase = false) {
|
|
28
|
+
return input.formatInitial(upperCase);
|
|
13
29
|
}
|
|
14
|
-
Utils.
|
|
30
|
+
Utils.formatInitial = formatInitial;
|
|
15
31
|
/**
|
|
16
|
-
* Format
|
|
17
|
-
* @param
|
|
32
|
+
* Format string with parameters
|
|
33
|
+
* @param template Template with {0}, {1}, ...
|
|
34
|
+
* @param parameters Parameters to fill the template
|
|
35
|
+
* @returns Result
|
|
18
36
|
*/
|
|
19
|
-
function
|
|
20
|
-
return
|
|
37
|
+
function formatString(template, ...parameters) {
|
|
38
|
+
return template.format(...parameters);
|
|
21
39
|
}
|
|
22
|
-
Utils.
|
|
40
|
+
Utils.formatString = formatString;
|
|
23
41
|
/**
|
|
24
42
|
* Get data changed fields with input data updated
|
|
25
43
|
* @param input Input data
|
|
@@ -170,9 +188,7 @@ export var Utils;
|
|
|
170
188
|
* @returns Result
|
|
171
189
|
*/
|
|
172
190
|
Utils.removeNonLetters = (input) => {
|
|
173
|
-
|
|
174
|
-
return input;
|
|
175
|
-
return input.replace(/[^a-zA-Z0-9]/g, '');
|
|
191
|
+
return input === null || input === void 0 ? void 0 : input.removeNonLetters();
|
|
176
192
|
};
|
|
177
193
|
/**
|
|
178
194
|
* Set source with new labels
|
|
@@ -203,9 +219,9 @@ export var Utils;
|
|
|
203
219
|
Utils.snakeNameToWord = (name, firstOnly = false) => {
|
|
204
220
|
const items = name.split('_');
|
|
205
221
|
if (firstOnly) {
|
|
206
|
-
items[0] =
|
|
222
|
+
items[0] = items[0].formatInitial(true);
|
|
207
223
|
return items.join(' ');
|
|
208
224
|
}
|
|
209
|
-
return items.map((part) =>
|
|
225
|
+
return items.map((part) => part.formatInitial(true)).join(' ');
|
|
210
226
|
};
|
|
211
227
|
})(Utils || (Utils = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.61",
|
|
4
4
|
"description": "TypeScript shared utilities and functions",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"<rootDir>/__tests__/**/*.ts"
|
|
25
25
|
],
|
|
26
26
|
"testEnvironment": "jsdom",
|
|
27
|
+
"moduleFileExtensions": [
|
|
28
|
+
"js",
|
|
29
|
+
"ts",
|
|
30
|
+
"d.ts"
|
|
31
|
+
],
|
|
27
32
|
"transform": {
|
|
28
33
|
".+\\.ts$": "ts-jest"
|
|
29
34
|
}
|
package/src/DomUtils.ts
CHANGED
|
@@ -108,9 +108,9 @@ export namespace DomUtils {
|
|
|
108
108
|
const properties = Object.keys(template);
|
|
109
109
|
|
|
110
110
|
// Entries
|
|
111
|
-
const entries =
|
|
112
|
-
? source
|
|
113
|
-
|
|
111
|
+
const entries = Object.entries(
|
|
112
|
+
isFormData(source) ? formDataToObject(source) : source
|
|
113
|
+
);
|
|
114
114
|
|
|
115
115
|
for (const [key, value] of entries) {
|
|
116
116
|
// Is included or keepSource
|
package/src/Utils.ts
CHANGED
|
@@ -1,23 +1,76 @@
|
|
|
1
1
|
import { DataTypes } from './DataTypes';
|
|
2
2
|
|
|
3
|
+
declare global {
|
|
4
|
+
interface String {
|
|
5
|
+
/**
|
|
6
|
+
* Format string
|
|
7
|
+
* @param this Template
|
|
8
|
+
* @param parameters Parameters to fill the template
|
|
9
|
+
*/
|
|
10
|
+
format(this: string, ...parameters: string[]): string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Forat inital character
|
|
14
|
+
* @param this Input string
|
|
15
|
+
* @param upperCase To upper case or lower case
|
|
16
|
+
*/
|
|
17
|
+
formatInitial(this: string, upperCase: boolean): string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Remove non letters (0-9, a-z, A-Z)
|
|
21
|
+
* @param this Input string
|
|
22
|
+
*/
|
|
23
|
+
removeNonLetters(this: string): string;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
String.prototype.format = function (
|
|
28
|
+
this: string,
|
|
29
|
+
...parameters: string[]
|
|
30
|
+
): string {
|
|
31
|
+
let template = this;
|
|
32
|
+
parameters.forEach((value, index) => {
|
|
33
|
+
template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
|
|
34
|
+
});
|
|
35
|
+
return template;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
String.prototype.formatInitial = function (
|
|
39
|
+
this: string,
|
|
40
|
+
upperCase: boolean = false
|
|
41
|
+
) {
|
|
42
|
+
const initial = this.charAt(0);
|
|
43
|
+
return (
|
|
44
|
+
(upperCase ? initial.toUpperCase() : initial.toLowerCase()) +
|
|
45
|
+
this.slice(1)
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
String.prototype.removeNonLetters = function (this: string) {
|
|
50
|
+
return this.replace(/[^a-zA-Z0-9]/g, '');
|
|
51
|
+
};
|
|
52
|
+
|
|
3
53
|
/**
|
|
4
54
|
* Utilities
|
|
5
55
|
*/
|
|
6
56
|
export namespace Utils {
|
|
7
57
|
/**
|
|
8
|
-
* Format
|
|
9
|
-
* @param
|
|
58
|
+
* Format inital character to lower case or upper case
|
|
59
|
+
* @param input Input string
|
|
60
|
+
* @param upperCase To upper case or lower case
|
|
10
61
|
*/
|
|
11
|
-
export function
|
|
12
|
-
return
|
|
62
|
+
export function formatInitial(input: string, upperCase: boolean = false) {
|
|
63
|
+
return input.formatInitial(upperCase);
|
|
13
64
|
}
|
|
14
65
|
|
|
15
66
|
/**
|
|
16
|
-
* Format
|
|
17
|
-
* @param
|
|
67
|
+
* Format string with parameters
|
|
68
|
+
* @param template Template with {0}, {1}, ...
|
|
69
|
+
* @param parameters Parameters to fill the template
|
|
70
|
+
* @returns Result
|
|
18
71
|
*/
|
|
19
|
-
export function
|
|
20
|
-
return
|
|
72
|
+
export function formatString(template: string, ...parameters: string[]) {
|
|
73
|
+
return template.format(...parameters);
|
|
21
74
|
}
|
|
22
75
|
|
|
23
76
|
/**
|
|
@@ -200,8 +253,7 @@ export namespace Utils {
|
|
|
200
253
|
* @returns Result
|
|
201
254
|
*/
|
|
202
255
|
export const removeNonLetters = (input?: string) => {
|
|
203
|
-
|
|
204
|
-
return input.replace(/[^a-zA-Z0-9]/g, '');
|
|
256
|
+
return input?.removeNonLetters();
|
|
205
257
|
};
|
|
206
258
|
|
|
207
259
|
/**
|
|
@@ -246,10 +298,10 @@ export namespace Utils {
|
|
|
246
298
|
) => {
|
|
247
299
|
const items = name.split('_');
|
|
248
300
|
if (firstOnly) {
|
|
249
|
-
items[0] =
|
|
301
|
+
items[0] = items[0].formatInitial(true);
|
|
250
302
|
return items.join(' ');
|
|
251
303
|
}
|
|
252
304
|
|
|
253
|
-
return items.map((part) =>
|
|
305
|
+
return items.map((part) => part.formatInitial(true)).join(' ');
|
|
254
306
|
};
|
|
255
307
|
}
|