@banyan_cloud/roots 2.0.47 → 2.0.48
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/dist/esm/index.js
CHANGED
|
@@ -3613,12 +3613,30 @@ var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oc
|
|
|
3613
3613
|
var FULL_MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
3614
3614
|
var DAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
3615
3615
|
|
|
3616
|
-
var getSpacedDisplayName = function getSpacedDisplayName(
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
var
|
|
3621
|
-
|
|
3616
|
+
var getSpacedDisplayName = function getSpacedDisplayName() {
|
|
3617
|
+
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3618
|
+
if (!input) return '';
|
|
3619
|
+
// 1) trim
|
|
3620
|
+
var str = input.trim();
|
|
3621
|
+
// 2) remove leading "_" or "-" (bounded, not greedy)
|
|
3622
|
+
str = str.replace(/^[_-]+/, '');
|
|
3623
|
+
// 3) normalize "_" and "-" to space
|
|
3624
|
+
// simple character class, global, safe
|
|
3625
|
+
str = str.replace(/[_-]+/g, ' ');
|
|
3626
|
+
// 4) camelCase: fooBar -> foo Bar
|
|
3627
|
+
str = str.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
3628
|
+
// 5) acronym-to-word: APIResponse -> API Response
|
|
3629
|
+
// (ALLCAPS)(Cap+lower) -> split
|
|
3630
|
+
str = str.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');
|
|
3631
|
+
// 6) collapse multiple spaces (in case we had "_-")
|
|
3632
|
+
str = str.replace(/\s+/g, ' ').trim();
|
|
3633
|
+
// 7) smart-capitalize: keep ALLCAPS as-is, title-case others
|
|
3634
|
+
var words = str.split(' ').map(function (word) {
|
|
3635
|
+
// preserve abbreviations like API, DB, GPT
|
|
3636
|
+
if (/^[A-Z]{2,}$/.test(word)) {
|
|
3637
|
+
return word;
|
|
3638
|
+
}
|
|
3639
|
+
// normal word → Capitalize
|
|
3622
3640
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
3623
3641
|
});
|
|
3624
3642
|
return words.join(' ');
|