@stryke/convert 0.4.0 → 0.5.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.
- package/dist/index.cjs +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/string-to-utf8-array.cjs +10 -0
- package/dist/string-to-utf8-array.d.ts +7 -0
- package/dist/string-to-utf8-array.mjs +1 -0
- package/dist/utf8-array-to-string.cjs +5 -3
- package/dist/utf8-array-to-string.d.ts +3 -6
- package/dist/utf8-array-to-string.mjs +1 -1
- package/package.json +16 -2
package/dist/index.cjs
CHANGED
|
@@ -58,6 +58,17 @@ Object.keys(_stringToUint8Array).forEach(function (key) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
var _stringToUtf8Array = require("./string-to-utf8-array.cjs");
|
|
62
|
+
Object.keys(_stringToUtf8Array).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _stringToUtf8Array[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _stringToUtf8Array[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
61
72
|
var _toArray = require("./to-array.cjs");
|
|
62
73
|
Object.keys(_toArray).forEach(function (key) {
|
|
63
74
|
if (key === "default" || key === "__esModule") return;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./buffer-to-string";
|
|
|
11
11
|
export * from "./parse-type-definition";
|
|
12
12
|
export * from "./string-to-buffer";
|
|
13
13
|
export * from "./string-to-uint8-array";
|
|
14
|
+
export * from "./string-to-utf8-array";
|
|
14
15
|
export * from "./to-array";
|
|
15
16
|
export * from "./to-string-key";
|
|
16
17
|
export * from "./uint8-array-to-stream";
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./array-buffer-to-string";export*from"./buffer-to-string";export*from"./parse-type-definition";export*from"./string-to-buffer";export*from"./string-to-uint8-array";export*from"./to-array";export*from"./to-string-key";export*from"./uint8-array-to-stream";export*from"./uint8-array-to-string";export*from"./utf8-array-to-string";
|
|
1
|
+
export*from"./array-buffer-to-string";export*from"./buffer-to-string";export*from"./parse-type-definition";export*from"./string-to-buffer";export*from"./string-to-uint8-array";export*from"./string-to-utf8-array";export*from"./to-array";export*from"./to-string-key";export*from"./uint8-array-to-stream";export*from"./uint8-array-to-string";export*from"./utf8-array-to-string";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=new TextEncoder;export function stringToUtf8Array(n){return r.encode(n)}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.utf8ArrayToString =
|
|
7
|
-
const
|
|
8
|
-
|
|
6
|
+
exports.utf8ArrayToString = utf8ArrayToString;
|
|
7
|
+
const r = new TextDecoder();
|
|
8
|
+
function utf8ArrayToString(e) {
|
|
9
|
+
return r.decode(e);
|
|
10
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Convert a
|
|
2
|
+
* Convert a utf-8 array to string
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
5
|
-
* @credits https://stackoverflow.com/a/36949791/1465919
|
|
6
|
-
*
|
|
7
|
-
* @param arr - Utf-8 Array
|
|
4
|
+
* @param input - Utf-8 Array
|
|
8
5
|
* @returns The converted string
|
|
9
6
|
*/
|
|
10
|
-
export declare
|
|
7
|
+
export declare function utf8ArrayToString(input: AllowSharedBufferSource): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const r=new TextDecoder;export function utf8ArrayToString(e){return r.decode(e)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/convert",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A utility package that helps convert between different data types.",
|
|
6
6
|
"repository": {
|
|
@@ -128,6 +128,20 @@
|
|
|
128
128
|
"default": "./dist/to-array.mjs"
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
+
"./string-to-utf8-array": {
|
|
132
|
+
"import": {
|
|
133
|
+
"types": "./dist/string-to-utf8-array.d.ts",
|
|
134
|
+
"default": "./dist/string-to-utf8-array.mjs"
|
|
135
|
+
},
|
|
136
|
+
"require": {
|
|
137
|
+
"types": "./dist/string-to-utf8-array.d.ts",
|
|
138
|
+
"default": "./dist/string-to-utf8-array.cjs"
|
|
139
|
+
},
|
|
140
|
+
"default": {
|
|
141
|
+
"types": "./dist/string-to-utf8-array.d.ts",
|
|
142
|
+
"default": "./dist/string-to-utf8-array.mjs"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
131
145
|
"./string-to-uint8-array": {
|
|
132
146
|
"import": {
|
|
133
147
|
"types": "./dist/string-to-uint8-array.d.ts",
|
|
@@ -219,5 +233,5 @@
|
|
|
219
233
|
"main": "./dist/index.cjs",
|
|
220
234
|
"module": "./dist/index.mjs",
|
|
221
235
|
"types": "./dist/index.d.ts",
|
|
222
|
-
"gitHead": "
|
|
236
|
+
"gitHead": "7331a32032c42269626a48f5011938b82dc80c45"
|
|
223
237
|
}
|