common-header-lib 0.0.21 → 0.0.22
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/assets/images/check.svg +3 -3
- package/assets/images/copy.svg +3 -3
- package/esm2020/lib/pipes/slice-to-two.pipe.mjs +12 -11
- package/fesm2015/common-header-lib.mjs +11 -10
- package/fesm2015/common-header-lib.mjs.map +1 -1
- package/fesm2020/common-header-lib.mjs +11 -10
- package/fesm2020/common-header-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/check.svg +3 -3
- package/src/assets/images/copy.svg +3 -3
|
@@ -2637,23 +2637,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2637
2637
|
|
|
2638
2638
|
class SliceToTwoPipe {
|
|
2639
2639
|
transform(textName) {
|
|
2640
|
-
if (textName
|
|
2640
|
+
if (!textName || typeof textName !== 'string') {
|
|
2641
2641
|
return 'NA';
|
|
2642
2642
|
}
|
|
2643
|
-
textName = textName
|
|
2644
|
-
let
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2643
|
+
textName = textName.trim();
|
|
2644
|
+
let separator = textName.includes(' ') ? ' ' : '_';
|
|
2645
|
+
let splitStringArr = textName
|
|
2646
|
+
.split(separator)
|
|
2647
|
+
.filter((part) => part.length > 0);
|
|
2648
|
+
if (splitStringArr.length === 0) {
|
|
2649
|
+
return 'NA';
|
|
2649
2650
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2651
|
+
let result = '';
|
|
2652
|
+
if (splitStringArr.length >= 2) {
|
|
2652
2653
|
result =
|
|
2653
2654
|
splitStringArr[0][0] + splitStringArr[splitStringArr.length - 1][0];
|
|
2654
2655
|
}
|
|
2655
2656
|
else {
|
|
2656
|
-
result =
|
|
2657
|
+
result = splitStringArr[0].slice(0, 2);
|
|
2657
2658
|
}
|
|
2658
2659
|
return result.toLocaleUpperCase();
|
|
2659
2660
|
}
|