@contrail/util 1.1.6 → 1.1.7-0
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.
|
@@ -67,6 +67,16 @@ class StringUtil {
|
|
|
67
67
|
static isArray(value) {
|
|
68
68
|
return Array.isArray(value);
|
|
69
69
|
}
|
|
70
|
+
static decodeEncodedString(encodedString) {
|
|
71
|
+
return encodedString.replace(/_COMMA_/g, ',').replace(/%[0-9A-Fa-f]{2}/g, (match) => {
|
|
72
|
+
try {
|
|
73
|
+
return decodeURIComponent(match);
|
|
74
|
+
}
|
|
75
|
+
catch (_a) {
|
|
76
|
+
return match;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
70
80
|
static getStringSizeInMB(str) {
|
|
71
81
|
const bytes = new TextEncoder().encode(str).length;
|
|
72
82
|
return bytes / (1024 * 1024);
|