@stryke/convert 0.5.0 → 0.6.1

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 CHANGED
@@ -102,7 +102,7 @@ Object.keys(_uint8ArrayToStream).forEach(function (key) {
102
102
  }
103
103
  });
104
104
  });
105
- var _uint8ArrayToString = require("./uint8-array-to-string.cjs");
105
+ var _uint8ArrayToString = require("./uint8-array-to-string.node.cjs");
106
106
  Object.keys(_uint8ArrayToString).forEach(function (key) {
107
107
  if (key === "default" || key === "__esModule") return;
108
108
  if (key in exports && exports[key] === _uint8ArrayToString[key]) return;
package/dist/index.d.ts CHANGED
@@ -15,5 +15,5 @@ export * from "./string-to-utf8-array";
15
15
  export * from "./to-array";
16
16
  export * from "./to-string-key";
17
17
  export * from "./uint8-array-to-stream";
18
- export * from "./uint8-array-to-string";
18
+ export * from "./uint8-array-to-string.node";
19
19
  export * from "./utf8-array-to-string";
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"./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";
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.node";export*from"./utf8-array-to-string";
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _arrayBufferToString = require("./array-buffer-to-string.cjs");
7
+ Object.keys(_arrayBufferToString).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _arrayBufferToString[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _arrayBufferToString[key];
14
+ }
15
+ });
16
+ });
17
+ var _parseTypeDefinition = require("./parse-type-definition.cjs");
18
+ Object.keys(_parseTypeDefinition).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _parseTypeDefinition[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _parseTypeDefinition[key];
25
+ }
26
+ });
27
+ });
28
+ var _stringToUint8Array = require("./string-to-uint8-array.cjs");
29
+ Object.keys(_stringToUint8Array).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _stringToUint8Array[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _stringToUint8Array[key];
36
+ }
37
+ });
38
+ });
39
+ var _stringToUtf8Array = require("./string-to-utf8-array.cjs");
40
+ Object.keys(_stringToUtf8Array).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _stringToUtf8Array[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _stringToUtf8Array[key];
47
+ }
48
+ });
49
+ });
50
+ var _toArray = require("./to-array.cjs");
51
+ Object.keys(_toArray).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _toArray[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _toArray[key];
58
+ }
59
+ });
60
+ });
61
+ var _toStringKey = require("./to-string-key.cjs");
62
+ Object.keys(_toStringKey).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _toStringKey[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _toStringKey[key];
69
+ }
70
+ });
71
+ });
72
+ var _uint8ArrayToStream = require("./uint8-array-to-stream.cjs");
73
+ Object.keys(_uint8ArrayToStream).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _uint8ArrayToStream[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _uint8ArrayToStream[key];
80
+ }
81
+ });
82
+ });
83
+ var _uint8ArrayToString = require("./uint8-array-to-string.cjs");
84
+ Object.keys(_uint8ArrayToString).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _uint8ArrayToString[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _uint8ArrayToString[key];
91
+ }
92
+ });
93
+ });
94
+ var _utf8ArrayToString = require("./utf8-array-to-string.cjs");
95
+ Object.keys(_utf8ArrayToString).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _utf8ArrayToString[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _utf8ArrayToString[key];
102
+ }
103
+ });
104
+ });
@@ -0,0 +1,9 @@
1
+ export * from "./array-buffer-to-string";
2
+ export * from "./parse-type-definition";
3
+ export * from "./string-to-uint8-array";
4
+ export * from "./string-to-utf8-array";
5
+ export * from "./to-array";
6
+ export * from "./to-string-key";
7
+ export * from "./uint8-array-to-stream";
8
+ export * from "./uint8-array-to-string";
9
+ export * from "./utf8-array-to-string";
@@ -0,0 +1 @@
1
+ export*from"./array-buffer-to-string";export*from"./parse-type-definition";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";
@@ -3,12 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.base64Uint8ArrayToString = base64Uint8ArrayToString;
7
- exports.uint8ArrayToString = void 0;
8
- var _nodeBuffer = require("node:buffer");
9
- var _arrayBufferToString = require("./array-buffer-to-string.cjs");
10
- const uint8ArrayToString = r => decodeURIComponent(_nodeBuffer.Buffer.from(r).toString("utf8"));
11
6
  exports.uint8ArrayToString = uint8ArrayToString;
12
- function base64Uint8ArrayToString(r) {
7
+ var _arrayBufferToString = require("./array-buffer-to-string.cjs");
8
+ function uint8ArrayToString(r) {
13
9
  return btoa((0, _arrayBufferToString.arrayBufferToString)(r));
14
10
  }
@@ -1,17 +1,7 @@
1
- /**
2
- * Convert a Uint8Array array to string
3
- *
4
- * @see https://stackoverflow.com/a/41798356/1465919
5
- * @see https://stackoverflow.com/a/36949791/1465919
6
- *
7
- * @param arr - Uint8Array to convert
8
- * @returns The converted string
9
- */
10
- export declare const uint8ArrayToString: (arr: Uint8Array) => string;
11
1
  /**
12
2
  * Convert a Uint8Array to a base64 string
13
3
  *
14
4
  * @param buffer - The Uint8Array to convert
15
5
  * @returns The converted base64 string
16
6
  */
17
- export declare function base64Uint8ArrayToString(buffer: Uint8Array): string;
7
+ export declare function uint8ArrayToString(buffer: Uint8Array): string;
@@ -1 +1 @@
1
- import{Buffer as t}from"node:buffer";import{arrayBufferToString as o}from"./array-buffer-to-string";export const uint8ArrayToString=r=>decodeURIComponent(t.from(r).toString("utf8"));export function base64Uint8ArrayToString(r){return btoa(o(r))}
1
+ import{arrayBufferToString as t}from"./array-buffer-to-string";export function uint8ArrayToString(r){return btoa(t(r))}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.uint8ArrayToString = void 0;
7
+ var _nodeBuffer = require("node:buffer");
8
+ const uint8ArrayToString = r => decodeURIComponent(_nodeBuffer.Buffer.from(r).toString("utf8"));
9
+ exports.uint8ArrayToString = uint8ArrayToString;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Convert a Uint8Array array to string
3
+ *
4
+ * @see https://stackoverflow.com/a/41798356/1465919
5
+ * @see https://stackoverflow.com/a/36949791/1465919
6
+ *
7
+ * @param arr - Uint8Array to convert
8
+ * @returns The converted string
9
+ */
10
+ export declare const uint8ArrayToString: (arr: Uint8Array) => string;
@@ -0,0 +1 @@
1
+ import{Buffer as t}from"node:buffer";export const uint8ArrayToString=r=>decodeURIComponent(t.from(r).toString("utf8"));
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.utf8ArrayToString = utf8ArrayToString;
7
- const r = new TextDecoder();
8
- function utf8ArrayToString(e) {
9
- return r.decode(e);
7
+ const e = new TextDecoder();
8
+ function utf8ArrayToString(r) {
9
+ return e.decode(r);
10
10
  }
@@ -4,4 +4,4 @@
4
4
  * @param input - Utf-8 Array
5
5
  * @returns The converted string
6
6
  */
7
- export declare function utf8ArrayToString(input: AllowSharedBufferSource): string;
7
+ export declare function utf8ArrayToString(input: NodeJS.ArrayBufferView | ArrayBuffer): string;
@@ -1 +1 @@
1
- const r=new TextDecoder;export function utf8ArrayToString(e){return r.decode(e)}
1
+ const e=new TextDecoder;export function utf8ArrayToString(r){return e.decode(r)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/convert",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "description": "A utility package that helps convert between different data types.",
6
6
  "repository": {
@@ -9,11 +9,11 @@
9
9
  "directory": "packages/convert"
10
10
  },
11
11
  "private": false,
12
- "devDependencies": { "@types/node": "^22.14.0" },
12
+ "devDependencies": { "@types/node": "^22.19.0" },
13
13
  "publishConfig": { "access": "public" },
14
14
  "dependencies": {
15
- "@stryke/type-checks": "^0.3.9",
16
- "@stryke/types": "^0.8.9"
15
+ "@stryke/type-checks": "^0.3.10",
16
+ "@stryke/types": "^0.10.0"
17
17
  },
18
18
  "sideEffects": false,
19
19
  "files": ["dist/**/*"],
@@ -86,6 +86,20 @@
86
86
  "default": "./dist/uint8-array-to-string.mjs"
87
87
  }
88
88
  },
89
+ "./uint8-array-to-string.node": {
90
+ "import": {
91
+ "types": "./dist/uint8-array-to-string.node.d.ts",
92
+ "default": "./dist/uint8-array-to-string.node.mjs"
93
+ },
94
+ "require": {
95
+ "types": "./dist/uint8-array-to-string.node.d.ts",
96
+ "default": "./dist/uint8-array-to-string.node.cjs"
97
+ },
98
+ "default": {
99
+ "types": "./dist/uint8-array-to-string.node.d.ts",
100
+ "default": "./dist/uint8-array-to-string.node.mjs"
101
+ }
102
+ },
89
103
  "./uint8-array-to-stream": {
90
104
  "import": {
91
105
  "types": "./dist/uint8-array-to-stream.d.ts",
@@ -184,6 +198,20 @@
184
198
  "default": "./dist/parse-type-definition.mjs"
185
199
  }
186
200
  },
201
+ "./neutral": {
202
+ "import": {
203
+ "types": "./dist/neutral.d.ts",
204
+ "default": "./dist/neutral.mjs"
205
+ },
206
+ "require": {
207
+ "types": "./dist/neutral.d.ts",
208
+ "default": "./dist/neutral.cjs"
209
+ },
210
+ "default": {
211
+ "types": "./dist/neutral.d.ts",
212
+ "default": "./dist/neutral.mjs"
213
+ }
214
+ },
187
215
  "./index": {
188
216
  "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
189
217
  "require": {
@@ -233,5 +261,5 @@
233
261
  "main": "./dist/index.cjs",
234
262
  "module": "./dist/index.mjs",
235
263
  "types": "./dist/index.d.ts",
236
- "gitHead": "7331a32032c42269626a48f5011938b82dc80c45"
264
+ "gitHead": "906d6304c09a8964297fa784f96377535fca6769"
237
265
  }