@contrail/util 1.1.5-alpha.1 → 1.1.6-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.
@@ -5,5 +5,6 @@ export declare class StringUtil {
5
5
  static convertToTitleCase(str: any): any;
6
6
  static isString(value: any): boolean;
7
7
  static isArray(value: any): boolean;
8
+ static decodeEncodedString(encodedString: string): string;
8
9
  static getStringSizeInMB(str: string): number;
9
10
  }
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/util",
3
- "version": "1.1.5-alpha.1",
3
+ "version": "1.1.6-0",
4
4
  "description": "General javascript utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",