@f5-sales-demo/pi-utils 21.13.1 → 21.13.2
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/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/materialize-string.ts +9 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-utils",
|
|
4
|
-
"version": "21.13.
|
|
4
|
+
"version": "21.13.2",
|
|
5
5
|
"description": "Shared utilities for pi packages",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/bun": "^1.3",
|
|
42
|
-
"@f5-sales-demo/pi-natives": "21.13.
|
|
42
|
+
"@f5-sales-demo/pi-natives": "21.13.2"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"bun": ">=1.3.7"
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy text into independent UTF-16 backing storage before a bounded substring
|
|
3
|
+
* outlives its source. The round trip preserves every JavaScript code unit,
|
|
4
|
+
* including lone surrogates that UTF-8 would replace.
|
|
5
|
+
*/
|
|
6
|
+
export function materializeString(text: string): string {
|
|
7
|
+
if (text.length === 0) return "";
|
|
8
|
+
return Buffer.from(text, "utf16le").toString("utf16le");
|
|
9
|
+
}
|