@stryke/convert 0.6.32 → 0.6.34
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/CHANGELOG.md +14 -0
- package/dist/array-buffer-to-string.cjs +19 -1
- package/dist/array-buffer-to-string.mjs +18 -1
- package/dist/array-buffer-to-string.mjs.map +1 -1
- package/dist/buffer-to-string.cjs +14 -1
- package/dist/buffer-to-string.mjs +13 -1
- package/dist/buffer-to-string.mjs.map +1 -1
- package/dist/index.cjs +27 -1
- package/dist/index.mjs +13 -1
- package/dist/neutral.cjs +23 -1
- package/dist/neutral.mjs +11 -1
- package/dist/parse-type-definition.cjs +37 -1
- package/dist/parse-type-definition.mjs +37 -1
- package/dist/parse-type-definition.mjs.map +1 -1
- package/dist/string-to-buffer.cjs +27 -1
- package/dist/string-to-buffer.mjs +27 -1
- package/dist/string-to-buffer.mjs.map +1 -1
- package/dist/string-to-uint8-array.cjs +37 -1
- package/dist/string-to-uint8-array.mjs +34 -1
- package/dist/string-to-uint8-array.mjs.map +1 -1
- package/dist/string-to-utf8-array.cjs +15 -1
- package/dist/string-to-utf8-array.mjs +14 -1
- package/dist/string-to-utf8-array.mjs.map +1 -1
- package/dist/to-array.cjs +15 -1
- package/dist/to-array.mjs +14 -1
- package/dist/to-array.mjs.map +1 -1
- package/dist/to-string-key.cjs +15 -1
- package/dist/to-string-key.mjs +14 -1
- package/dist/to-string-key.mjs.map +1 -1
- package/dist/type-checks/src/get-object-tag.cjs +15 -1
- package/dist/type-checks/src/get-object-tag.mjs +14 -1
- package/dist/type-checks/src/get-object-tag.mjs.map +1 -1
- package/dist/type-checks/src/index.cjs +7 -1
- package/dist/type-checks/src/index.mjs +9 -1
- package/dist/type-checks/src/is-buffer.cjs +12 -1
- package/dist/type-checks/src/is-buffer.mjs +11 -1
- package/dist/type-checks/src/is-buffer.mjs.map +1 -1
- package/dist/type-checks/src/is-collection.cjs +1 -1
- package/dist/type-checks/src/is-collection.mjs +3 -1
- package/dist/type-checks/src/is-object.cjs +19 -1
- package/dist/type-checks/src/is-object.mjs +19 -1
- package/dist/type-checks/src/is-object.mjs.map +1 -1
- package/dist/type-checks/src/is-plain-object.cjs +64 -1
- package/dist/type-checks/src/is-plain-object.mjs +63 -1
- package/dist/type-checks/src/is-plain-object.mjs.map +1 -1
- package/dist/type-checks/src/is-string.cjs +12 -1
- package/dist/type-checks/src/is-string.mjs +11 -1
- package/dist/type-checks/src/is-string.mjs.map +1 -1
- package/dist/type-checks/src/type-detect.cjs +15 -1
- package/dist/type-checks/src/type-detect.mjs +16 -1
- package/dist/type-checks/src/type-detect.mjs.map +1 -1
- package/dist/uint8-array-to-stream.cjs +49 -1
- package/dist/uint8-array-to-stream.mjs +46 -1
- package/dist/uint8-array-to-stream.mjs.map +1 -1
- package/dist/uint8-array-to-string.cjs +15 -1
- package/dist/uint8-array-to-string.mjs +15 -1
- package/dist/uint8-array-to-string.mjs.map +1 -1
- package/dist/uint8-array-to-string.node.cjs +16 -1
- package/dist/uint8-array-to-string.node.mjs +16 -1
- package/dist/uint8-array-to-string.node.mjs.map +1 -1
- package/dist/utf8-array-to-string.cjs +15 -1
- package/dist/utf8-array-to-string.mjs +14 -1
- package/dist/utf8-array-to-string.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - Convert
|
|
4
4
|
|
|
5
|
+
## [0.6.33](https://github.com/storm-software/stryke/releases/tag/convert%400.6.33) (01/16/2026)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **type-checks** to **v0.5.18**
|
|
10
|
+
- Updated **types** to **v0.10.32**
|
|
11
|
+
|
|
12
|
+
## [0.6.32](https://github.com/storm-software/stryke/releases/tag/convert%400.6.32) (01/15/2026)
|
|
13
|
+
|
|
14
|
+
### Updated Dependencies
|
|
15
|
+
|
|
16
|
+
- Updated **type-checks** to **v0.5.17**
|
|
17
|
+
- Updated **types** to **v0.10.31**
|
|
18
|
+
|
|
5
19
|
## [0.6.31](https://github.com/storm-software/stryke/releases/tag/convert%400.6.31) (01/13/2026)
|
|
6
20
|
|
|
7
21
|
### Updated Dependencies
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/array-buffer-to-string.ts
|
|
3
|
+
/**
|
|
4
|
+
* Convert an ArrayBuffer or Uint8Array to a string
|
|
5
|
+
*
|
|
6
|
+
* @param buffer - The ArrayBuffer or Uint8Array to convert
|
|
7
|
+
* @returns The converted string
|
|
8
|
+
*/
|
|
9
|
+
function arrayBufferToString(buffer) {
|
|
10
|
+
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
11
|
+
const len = bytes.byteLength;
|
|
12
|
+
if (len < 65535) return String.fromCharCode.apply(null, bytes);
|
|
13
|
+
let binary = "";
|
|
14
|
+
for (let i = 0; i < len; i++) binary += String.fromCharCode(bytes[i]);
|
|
15
|
+
return binary;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.arrayBufferToString = arrayBufferToString;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/array-buffer-to-string.ts
|
|
2
|
+
/**
|
|
3
|
+
* Convert an ArrayBuffer or Uint8Array to a string
|
|
4
|
+
*
|
|
5
|
+
* @param buffer - The ArrayBuffer or Uint8Array to convert
|
|
6
|
+
* @returns The converted string
|
|
7
|
+
*/
|
|
8
|
+
function arrayBufferToString(buffer) {
|
|
9
|
+
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
10
|
+
const len = bytes.byteLength;
|
|
11
|
+
if (len < 65535) return String.fromCharCode.apply(null, bytes);
|
|
12
|
+
let binary = "";
|
|
13
|
+
for (let i = 0; i < len; i++) binary += String.fromCharCode(bytes[i]);
|
|
14
|
+
return binary;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { arrayBufferToString };
|
|
2
19
|
//# sourceMappingURL=array-buffer-to-string.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-buffer-to-string.mjs","names":[],"sources":["../src/array-buffer-to-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert an ArrayBuffer or Uint8Array to a string\n *\n * @param buffer - The ArrayBuffer or Uint8Array to convert\n * @returns The converted string\n */\nexport function arrayBufferToString(\n buffer: ArrayBuffer | ArrayBufferLike | Uint8Array\n): string {\n const bytes =\n buffer instanceof Uint8Array\n ? buffer\n : new Uint8Array(buffer as ArrayBufferLike);\n const len = bytes.byteLength;\n if (len < 65535) {\n return String.fromCharCode.apply(null, bytes as unknown as number[]);\n }\n let binary = \"\";\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]!);\n }\n return binary;\n}\n"],"mappings":"AAwBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"array-buffer-to-string.mjs","names":[],"sources":["../src/array-buffer-to-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert an ArrayBuffer or Uint8Array to a string\n *\n * @param buffer - The ArrayBuffer or Uint8Array to convert\n * @returns The converted string\n */\nexport function arrayBufferToString(\n buffer: ArrayBuffer | ArrayBufferLike | Uint8Array\n): string {\n const bytes =\n buffer instanceof Uint8Array\n ? buffer\n : new Uint8Array(buffer as ArrayBufferLike);\n const len = bytes.byteLength;\n if (len < 65535) {\n return String.fromCharCode.apply(null, bytes as unknown as number[]);\n }\n let binary = \"\";\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]!);\n }\n return binary;\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,oBACd,QACQ;CACR,MAAM,QACJ,kBAAkB,aACd,SACA,IAAI,WAAW,OAA0B;CAC/C,MAAM,MAAM,MAAM;AAClB,KAAI,MAAM,MACR,QAAO,OAAO,aAAa,MAAM,MAAM,MAA6B;CAEtE,IAAI,SAAS;AACb,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IACvB,WAAU,OAAO,aAAa,MAAM,GAAI;AAE1C,QAAO"}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/buffer-to-string.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts a buffer to a string.
|
|
5
|
+
*
|
|
6
|
+
* @param buf - The buffer to convert.
|
|
7
|
+
* @returns The converted string.
|
|
8
|
+
*/
|
|
9
|
+
function bufferToString(buf) {
|
|
10
|
+
return buf.toString("utf8");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.bufferToString = bufferToString;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/buffer-to-string.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a buffer to a string.
|
|
4
|
+
*
|
|
5
|
+
* @param buf - The buffer to convert.
|
|
6
|
+
* @returns The converted string.
|
|
7
|
+
*/
|
|
8
|
+
function bufferToString(buf) {
|
|
9
|
+
return buf.toString("utf8");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { bufferToString };
|
|
2
14
|
//# sourceMappingURL=buffer-to-string.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-to-string.mjs","names":[],"sources":["../src/buffer-to-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Buffer } from \"node:buffer\";\n\n/**\n * Converts a buffer to a string.\n *\n * @param buf - The buffer to convert.\n * @returns The converted string.\n */\nexport function bufferToString(buf: Buffer | string): string {\n return buf.toString(\"utf8\");\n}\n"],"mappings":"AA0BA,SAAgB,
|
|
1
|
+
{"version":3,"file":"buffer-to-string.mjs","names":[],"sources":["../src/buffer-to-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Buffer } from \"node:buffer\";\n\n/**\n * Converts a buffer to a string.\n *\n * @param buf - The buffer to convert.\n * @returns The converted string.\n */\nexport function bufferToString(buf: Buffer | string): string {\n return buf.toString(\"utf8\");\n}\n"],"mappings":";;;;;;;AA0BA,SAAgB,eAAe,KAA8B;AAC3D,QAAO,IAAI,SAAS,OAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_array_buffer_to_string = require('./array-buffer-to-string.cjs');
|
|
2
|
+
const require_buffer_to_string = require('./buffer-to-string.cjs');
|
|
3
|
+
const require_parse_type_definition = require('./parse-type-definition.cjs');
|
|
4
|
+
const require_string_to_buffer = require('./string-to-buffer.cjs');
|
|
5
|
+
const require_string_to_uint8_array = require('./string-to-uint8-array.cjs');
|
|
6
|
+
const require_string_to_utf8_array = require('./string-to-utf8-array.cjs');
|
|
7
|
+
const require_to_array = require('./to-array.cjs');
|
|
8
|
+
const require_to_string_key = require('./to-string-key.cjs');
|
|
9
|
+
const require_uint8_array_to_stream = require('./uint8-array-to-stream.cjs');
|
|
10
|
+
const require_uint8_array_to_string_node = require('./uint8-array-to-string.node.cjs');
|
|
11
|
+
const require_utf8_array_to_string = require('./utf8-array-to-string.cjs');
|
|
12
|
+
|
|
13
|
+
exports.arrayBufferToString = require_array_buffer_to_string.arrayBufferToString;
|
|
14
|
+
exports.base64StringToUint8Array = require_string_to_uint8_array.base64StringToUint8Array;
|
|
15
|
+
exports.binaryStringToUint8Array = require_string_to_uint8_array.binaryStringToUint8Array;
|
|
16
|
+
exports.bufferToString = require_buffer_to_string.bufferToString;
|
|
17
|
+
exports.concatUint8Array = require_uint8_array_to_stream.concatUint8Array;
|
|
18
|
+
exports.concatUint8ArrayStream = require_uint8_array_to_stream.concatUint8ArrayStream;
|
|
19
|
+
exports.parseTypeDefinition = require_parse_type_definition.parseTypeDefinition;
|
|
20
|
+
exports.stringToBuffer = require_string_to_buffer.stringToBuffer;
|
|
21
|
+
exports.stringToUint8Array = require_string_to_uint8_array.stringToUint8Array;
|
|
22
|
+
exports.stringToUtf8Array = require_string_to_utf8_array.stringToUtf8Array;
|
|
23
|
+
exports.toArray = require_to_array.toArray;
|
|
24
|
+
exports.toStringKey = require_to_string_key.toStringKey;
|
|
25
|
+
exports.uint8ArrayToStream = require_uint8_array_to_stream.uint8ArrayToStream;
|
|
26
|
+
exports.uint8ArrayToString = require_uint8_array_to_string_node.uint8ArrayToString;
|
|
27
|
+
exports.utf8ArrayToString = require_utf8_array_to_string.utf8ArrayToString;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { arrayBufferToString } from "./array-buffer-to-string.mjs";
|
|
2
|
+
import { bufferToString } from "./buffer-to-string.mjs";
|
|
3
|
+
import { parseTypeDefinition } from "./parse-type-definition.mjs";
|
|
4
|
+
import { stringToBuffer } from "./string-to-buffer.mjs";
|
|
5
|
+
import { base64StringToUint8Array, binaryStringToUint8Array, stringToUint8Array } from "./string-to-uint8-array.mjs";
|
|
6
|
+
import { stringToUtf8Array } from "./string-to-utf8-array.mjs";
|
|
7
|
+
import { toArray } from "./to-array.mjs";
|
|
8
|
+
import { toStringKey } from "./to-string-key.mjs";
|
|
9
|
+
import { concatUint8Array, concatUint8ArrayStream, uint8ArrayToStream } from "./uint8-array-to-stream.mjs";
|
|
10
|
+
import { uint8ArrayToString } from "./uint8-array-to-string.node.mjs";
|
|
11
|
+
import { utf8ArrayToString } from "./utf8-array-to-string.mjs";
|
|
12
|
+
|
|
13
|
+
export { arrayBufferToString, base64StringToUint8Array, binaryStringToUint8Array, bufferToString, concatUint8Array, concatUint8ArrayStream, parseTypeDefinition, stringToBuffer, stringToUint8Array, stringToUtf8Array, toArray, toStringKey, uint8ArrayToStream, uint8ArrayToString, utf8ArrayToString };
|
package/dist/neutral.cjs
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_array_buffer_to_string = require('./array-buffer-to-string.cjs');
|
|
2
|
+
const require_parse_type_definition = require('./parse-type-definition.cjs');
|
|
3
|
+
const require_string_to_uint8_array = require('./string-to-uint8-array.cjs');
|
|
4
|
+
const require_string_to_utf8_array = require('./string-to-utf8-array.cjs');
|
|
5
|
+
const require_to_array = require('./to-array.cjs');
|
|
6
|
+
const require_to_string_key = require('./to-string-key.cjs');
|
|
7
|
+
const require_uint8_array_to_stream = require('./uint8-array-to-stream.cjs');
|
|
8
|
+
const require_utf8_array_to_string = require('./utf8-array-to-string.cjs');
|
|
9
|
+
const require_uint8_array_to_string = require('./uint8-array-to-string.cjs');
|
|
10
|
+
|
|
11
|
+
exports.arrayBufferToString = require_array_buffer_to_string.arrayBufferToString;
|
|
12
|
+
exports.base64StringToUint8Array = require_string_to_uint8_array.base64StringToUint8Array;
|
|
13
|
+
exports.binaryStringToUint8Array = require_string_to_uint8_array.binaryStringToUint8Array;
|
|
14
|
+
exports.concatUint8Array = require_uint8_array_to_stream.concatUint8Array;
|
|
15
|
+
exports.concatUint8ArrayStream = require_uint8_array_to_stream.concatUint8ArrayStream;
|
|
16
|
+
exports.parseTypeDefinition = require_parse_type_definition.parseTypeDefinition;
|
|
17
|
+
exports.stringToUint8Array = require_string_to_uint8_array.stringToUint8Array;
|
|
18
|
+
exports.stringToUtf8Array = require_string_to_utf8_array.stringToUtf8Array;
|
|
19
|
+
exports.toArray = require_to_array.toArray;
|
|
20
|
+
exports.toStringKey = require_to_string_key.toStringKey;
|
|
21
|
+
exports.uint8ArrayToStream = require_uint8_array_to_stream.uint8ArrayToStream;
|
|
22
|
+
exports.uint8ArrayToString = require_uint8_array_to_string.uint8ArrayToString;
|
|
23
|
+
exports.utf8ArrayToString = require_utf8_array_to_string.utf8ArrayToString;
|
package/dist/neutral.mjs
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { arrayBufferToString } from "./array-buffer-to-string.mjs";
|
|
2
|
+
import { parseTypeDefinition } from "./parse-type-definition.mjs";
|
|
3
|
+
import { base64StringToUint8Array, binaryStringToUint8Array, stringToUint8Array } from "./string-to-uint8-array.mjs";
|
|
4
|
+
import { stringToUtf8Array } from "./string-to-utf8-array.mjs";
|
|
5
|
+
import { toArray } from "./to-array.mjs";
|
|
6
|
+
import { toStringKey } from "./to-string-key.mjs";
|
|
7
|
+
import { concatUint8Array, concatUint8ArrayStream, uint8ArrayToStream } from "./uint8-array-to-stream.mjs";
|
|
8
|
+
import { utf8ArrayToString } from "./utf8-array-to-string.mjs";
|
|
9
|
+
import { uint8ArrayToString } from "./uint8-array-to-string.mjs";
|
|
10
|
+
|
|
11
|
+
export { arrayBufferToString, base64StringToUint8Array, binaryStringToUint8Array, concatUint8Array, concatUint8ArrayStream, parseTypeDefinition, stringToUint8Array, stringToUtf8Array, toArray, toStringKey, uint8ArrayToStream, uint8ArrayToString, utf8ArrayToString };
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_is_object = require('./type-checks/src/is-object.cjs');
|
|
2
|
+
const require_is_string = require('./type-checks/src/is-string.cjs');
|
|
3
|
+
require('./type-checks/src/index.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/parse-type-definition.ts
|
|
6
|
+
/**
|
|
7
|
+
* Parse a type definition parameter into a {@link TypeDefinition} object
|
|
8
|
+
*
|
|
9
|
+
* @param param - The parameter to parse
|
|
10
|
+
* @returns The parsed type definition
|
|
11
|
+
*/
|
|
12
|
+
const parseTypeDefinition = (param) => {
|
|
13
|
+
if (require_is_string.isString(param)) {
|
|
14
|
+
if (param.includes(":")) {
|
|
15
|
+
const params = param.split(":");
|
|
16
|
+
if (params.length > 1 && params[0]) return {
|
|
17
|
+
file: params[0],
|
|
18
|
+
name: params[1]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (param.includes("#")) {
|
|
22
|
+
const params = param.split("#");
|
|
23
|
+
if (params.length > 1 && params[0]) return {
|
|
24
|
+
file: params[0],
|
|
25
|
+
name: params[1]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { file: param };
|
|
29
|
+
}
|
|
30
|
+
if (require_is_object.isObject(param)) return {
|
|
31
|
+
file: param.file,
|
|
32
|
+
name: param.name
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.parseTypeDefinition = parseTypeDefinition;
|
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import{isObject
|
|
1
|
+
import { isObject } from "./type-checks/src/is-object.mjs";
|
|
2
|
+
import { isString } from "./type-checks/src/is-string.mjs";
|
|
3
|
+
import "./type-checks/src/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/parse-type-definition.ts
|
|
6
|
+
/**
|
|
7
|
+
* Parse a type definition parameter into a {@link TypeDefinition} object
|
|
8
|
+
*
|
|
9
|
+
* @param param - The parameter to parse
|
|
10
|
+
* @returns The parsed type definition
|
|
11
|
+
*/
|
|
12
|
+
const parseTypeDefinition = (param) => {
|
|
13
|
+
if (isString(param)) {
|
|
14
|
+
if (param.includes(":")) {
|
|
15
|
+
const params = param.split(":");
|
|
16
|
+
if (params.length > 1 && params[0]) return {
|
|
17
|
+
file: params[0],
|
|
18
|
+
name: params[1]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (param.includes("#")) {
|
|
22
|
+
const params = param.split("#");
|
|
23
|
+
if (params.length > 1 && params[0]) return {
|
|
24
|
+
file: params[0],
|
|
25
|
+
name: params[1]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { file: param };
|
|
29
|
+
}
|
|
30
|
+
if (isObject(param)) return {
|
|
31
|
+
file: param.file,
|
|
32
|
+
name: param.name
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { parseTypeDefinition };
|
|
2
38
|
//# sourceMappingURL=parse-type-definition.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-type-definition.mjs","names":[],"sources":["../src/parse-type-definition.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isObject, isString } from \"@stryke/type-checks\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\n\n/**\n * Parse a type definition parameter into a {@link TypeDefinition} object\n *\n * @param param - The parameter to parse\n * @returns The parsed type definition\n */\nexport const parseTypeDefinition = (\n param: TypeDefinitionParameter\n): TypeDefinition | undefined => {\n if (isString(param)) {\n if (param.includes(\":\")) {\n const params = param.split(\":\");\n if (params.length > 1 && params[0]) {\n return {\n file: params[0],\n name: params[1]\n };\n }\n }\n\n if (param.includes(\"#\")) {\n const params = param.split(\"#\");\n if (params.length > 1 && params[0]) {\n return {\n file: params[0],\n name: params[1]\n };\n }\n }\n\n return {\n file: param\n };\n }\n\n if (isObject(param)) {\n return {\n file: param.file,\n name: param.name\n };\n }\n\n return undefined;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-type-definition.mjs","names":[],"sources":["../src/parse-type-definition.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isObject, isString } from \"@stryke/type-checks\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\n\n/**\n * Parse a type definition parameter into a {@link TypeDefinition} object\n *\n * @param param - The parameter to parse\n * @returns The parsed type definition\n */\nexport const parseTypeDefinition = (\n param: TypeDefinitionParameter\n): TypeDefinition | undefined => {\n if (isString(param)) {\n if (param.includes(\":\")) {\n const params = param.split(\":\");\n if (params.length > 1 && params[0]) {\n return {\n file: params[0],\n name: params[1]\n };\n }\n }\n\n if (param.includes(\"#\")) {\n const params = param.split(\"#\");\n if (params.length > 1 && params[0]) {\n return {\n file: params[0],\n name: params[1]\n };\n }\n }\n\n return {\n file: param\n };\n }\n\n if (isObject(param)) {\n return {\n file: param.file,\n name: param.name\n };\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;;;;;;AA8BA,MAAa,uBACX,UAC+B;AAC/B,KAAI,SAAS,MAAM,EAAE;AACnB,MAAI,MAAM,SAAS,IAAI,EAAE;GACvB,MAAM,SAAS,MAAM,MAAM,IAAI;AAC/B,OAAI,OAAO,SAAS,KAAK,OAAO,GAC9B,QAAO;IACL,MAAM,OAAO;IACb,MAAM,OAAO;IACd;;AAIL,MAAI,MAAM,SAAS,IAAI,EAAE;GACvB,MAAM,SAAS,MAAM,MAAM,IAAI;AAC/B,OAAI,OAAO,SAAS,KAAK,OAAO,GAC9B,QAAO;IACL,MAAM,OAAO;IACb,MAAM,OAAO;IACd;;AAIL,SAAO,EACL,MAAM,OACP;;AAGH,KAAI,SAAS,MAAM,CACjB,QAAO;EACL,MAAM,MAAM;EACZ,MAAM,MAAM;EACb"}
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
let
|
|
1
|
+
let node_buffer = require("node:buffer");
|
|
2
|
+
|
|
3
|
+
//#region src/string-to-buffer.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a string to a Buffer.
|
|
6
|
+
*
|
|
7
|
+
* @param str - The string to convert.
|
|
8
|
+
* @returns The converted Buffer.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { stringToBuffer } from "@stryke/convert";
|
|
13
|
+
*
|
|
14
|
+
* const buffer = stringToBuffer("Hello, world!");
|
|
15
|
+
* console.log(buffer); // <Buffer 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21>
|
|
16
|
+
* ```
|
|
17
|
+
* @see https://nodejs.org/api/buffer.html#buffer_class_buffer
|
|
18
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Buffer
|
|
19
|
+
* @see https://stackoverflow.com/a/41798356/1465919
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
function stringToBuffer(str) {
|
|
23
|
+
return node_buffer.Buffer.from(str, "utf8");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.stringToBuffer = stringToBuffer;
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
import{Buffer
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
|
|
3
|
+
//#region src/string-to-buffer.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a string to a Buffer.
|
|
6
|
+
*
|
|
7
|
+
* @param str - The string to convert.
|
|
8
|
+
* @returns The converted Buffer.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { stringToBuffer } from "@stryke/convert";
|
|
13
|
+
*
|
|
14
|
+
* const buffer = stringToBuffer("Hello, world!");
|
|
15
|
+
* console.log(buffer); // <Buffer 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21>
|
|
16
|
+
* ```
|
|
17
|
+
* @see https://nodejs.org/api/buffer.html#buffer_class_buffer
|
|
18
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Buffer
|
|
19
|
+
* @see https://stackoverflow.com/a/41798356/1465919
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
function stringToBuffer(str) {
|
|
23
|
+
return Buffer.from(str, "utf8");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { stringToBuffer };
|
|
2
28
|
//# sourceMappingURL=string-to-buffer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-buffer.mjs","names":[],"sources":["../src/string-to-buffer.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Buffer } from \"node:buffer\";\n\n/**\n * Converts a string to a Buffer.\n *\n * @param str - The string to convert.\n * @returns The converted Buffer.\n *\n * @example\n * ```ts\n * import { stringToBuffer } from \"@stryke/convert\";\n *\n * const buffer = stringToBuffer(\"Hello, world!\");\n * console.log(buffer); // <Buffer 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21>\n * ```\n * @see https://nodejs.org/api/buffer.html#buffer_class_buffer\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Buffer\n * @see https://stackoverflow.com/a/41798356/1465919\n *\n */\nexport function stringToBuffer(str: string): Buffer {\n return Buffer.from(str, \"utf8\");\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"string-to-buffer.mjs","names":[],"sources":["../src/string-to-buffer.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Buffer } from \"node:buffer\";\n\n/**\n * Converts a string to a Buffer.\n *\n * @param str - The string to convert.\n * @returns The converted Buffer.\n *\n * @example\n * ```ts\n * import { stringToBuffer } from \"@stryke/convert\";\n *\n * const buffer = stringToBuffer(\"Hello, world!\");\n * console.log(buffer); // <Buffer 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21>\n * ```\n * @see https://nodejs.org/api/buffer.html#buffer_class_buffer\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Buffer\n * @see https://stackoverflow.com/a/41798356/1465919\n *\n */\nexport function stringToBuffer(str: string): Buffer {\n return Buffer.from(str, \"utf8\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,eAAe,KAAqB;AAClD,QAAO,OAAO,KAAK,KAAK,OAAO"}
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/string-to-uint8-array.ts
|
|
3
|
+
/**
|
|
4
|
+
* Convert a string to Uint8Array
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to convert
|
|
7
|
+
* @returns The converted Uint8Array
|
|
8
|
+
*/
|
|
9
|
+
function stringToUint8Array(text) {
|
|
10
|
+
return Uint8Array.from([...encodeURIComponent(text)].map((letter) => letter.codePointAt(0)));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Convert a binary string to Uint8Array
|
|
14
|
+
*
|
|
15
|
+
* @param binary - The binary string to convert
|
|
16
|
+
* @returns The converted Uint8Array
|
|
17
|
+
*/
|
|
18
|
+
function binaryStringToUint8Array(binary) {
|
|
19
|
+
const len = binary.length;
|
|
20
|
+
const arr = new Uint8Array(len);
|
|
21
|
+
for (let i = 0; i < len; i++) arr[i] = binary.charCodeAt(i);
|
|
22
|
+
return arr;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Convert a base64 string to a Uint8Array
|
|
26
|
+
*
|
|
27
|
+
* @param data - The base64 string to convert
|
|
28
|
+
* @returns The converted Uint8Array
|
|
29
|
+
*/
|
|
30
|
+
function base64StringToUint8Array(data) {
|
|
31
|
+
return stringToUint8Array(atob(data));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.base64StringToUint8Array = base64StringToUint8Array;
|
|
36
|
+
exports.binaryStringToUint8Array = binaryStringToUint8Array;
|
|
37
|
+
exports.stringToUint8Array = stringToUint8Array;
|
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/string-to-uint8-array.ts
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string to Uint8Array
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to convert
|
|
6
|
+
* @returns The converted Uint8Array
|
|
7
|
+
*/
|
|
8
|
+
function stringToUint8Array(text) {
|
|
9
|
+
return Uint8Array.from([...encodeURIComponent(text)].map((letter) => letter.codePointAt(0)));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert a binary string to Uint8Array
|
|
13
|
+
*
|
|
14
|
+
* @param binary - The binary string to convert
|
|
15
|
+
* @returns The converted Uint8Array
|
|
16
|
+
*/
|
|
17
|
+
function binaryStringToUint8Array(binary) {
|
|
18
|
+
const len = binary.length;
|
|
19
|
+
const arr = new Uint8Array(len);
|
|
20
|
+
for (let i = 0; i < len; i++) arr[i] = binary.charCodeAt(i);
|
|
21
|
+
return arr;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Convert a base64 string to a Uint8Array
|
|
25
|
+
*
|
|
26
|
+
* @param data - The base64 string to convert
|
|
27
|
+
* @returns The converted Uint8Array
|
|
28
|
+
*/
|
|
29
|
+
function base64StringToUint8Array(data) {
|
|
30
|
+
return stringToUint8Array(atob(data));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { base64StringToUint8Array, binaryStringToUint8Array, stringToUint8Array };
|
|
2
35
|
//# sourceMappingURL=string-to-uint8-array.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-uint8-array.mjs","names":[],"sources":["../src/string-to-uint8-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a string to Uint8Array\n *\n * @param text - The text to convert\n * @returns The converted Uint8Array\n */\nexport function stringToUint8Array(text: string): Uint8Array {\n return Uint8Array.from(\n [...encodeURIComponent(text)].map(letter => letter.codePointAt(0)!)\n );\n}\n\n/**\n * Convert a binary string to Uint8Array\n *\n * @param binary - The binary string to convert\n * @returns The converted Uint8Array\n */\nexport function binaryStringToUint8Array(binary: string): Uint8Array {\n const len = binary.length;\n const arr = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n arr[i] = binary.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Convert a base64 string to a Uint8Array\n *\n * @param data - The base64 string to convert\n * @returns The converted Uint8Array\n */\nexport function base64StringToUint8Array(data: string): Uint8Array {\n return stringToUint8Array(atob(data));\n}\n"],"mappings":"AAwBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"string-to-uint8-array.mjs","names":[],"sources":["../src/string-to-uint8-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a string to Uint8Array\n *\n * @param text - The text to convert\n * @returns The converted Uint8Array\n */\nexport function stringToUint8Array(text: string): Uint8Array {\n return Uint8Array.from(\n [...encodeURIComponent(text)].map(letter => letter.codePointAt(0)!)\n );\n}\n\n/**\n * Convert a binary string to Uint8Array\n *\n * @param binary - The binary string to convert\n * @returns The converted Uint8Array\n */\nexport function binaryStringToUint8Array(binary: string): Uint8Array {\n const len = binary.length;\n const arr = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n arr[i] = binary.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Convert a base64 string to a Uint8Array\n *\n * @param data - The base64 string to convert\n * @returns The converted Uint8Array\n */\nexport function base64StringToUint8Array(data: string): Uint8Array {\n return stringToUint8Array(atob(data));\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,mBAAmB,MAA0B;AAC3D,QAAO,WAAW,KAChB,CAAC,GAAG,mBAAmB,KAAK,CAAC,CAAC,KAAI,WAAU,OAAO,YAAY,EAAE,CAAE,CACpE;;;;;;;;AASH,SAAgB,yBAAyB,QAA4B;CACnE,MAAM,MAAM,OAAO;CACnB,MAAM,MAAM,IAAI,WAAW,IAAI;AAC/B,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IACvB,KAAI,KAAK,OAAO,WAAW,EAAE;AAE/B,QAAO;;;;;;;;AAST,SAAgB,yBAAyB,MAA0B;AACjE,QAAO,mBAAmB,KAAK,KAAK,CAAC"}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/string-to-utf8-array.ts
|
|
3
|
+
const encoder = new TextEncoder();
|
|
4
|
+
/**
|
|
5
|
+
* Convert a string to a utf-8 array
|
|
6
|
+
*
|
|
7
|
+
* @param input - The string to convert
|
|
8
|
+
* @returns The converted utf-8 array
|
|
9
|
+
*/
|
|
10
|
+
function stringToUtf8Array(input) {
|
|
11
|
+
return encoder.encode(input);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.stringToUtf8Array = stringToUtf8Array;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/string-to-utf8-array.ts
|
|
2
|
+
const encoder = new TextEncoder();
|
|
3
|
+
/**
|
|
4
|
+
* Convert a string to a utf-8 array
|
|
5
|
+
*
|
|
6
|
+
* @param input - The string to convert
|
|
7
|
+
* @returns The converted utf-8 array
|
|
8
|
+
*/
|
|
9
|
+
function stringToUtf8Array(input) {
|
|
10
|
+
return encoder.encode(input);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { stringToUtf8Array };
|
|
2
15
|
//# sourceMappingURL=string-to-utf8-array.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-utf8-array.mjs","names":[],"sources":["../src/string-to-utf8-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst encoder = new TextEncoder();\n\n/**\n * Convert a string to a utf-8 array\n *\n * @param input - The string to convert\n * @returns The converted utf-8 array\n */\nexport function stringToUtf8Array(input: string): Uint8Array {\n return encoder.encode(input);\n}\n"],"mappings":"AAkBA,MAAM,
|
|
1
|
+
{"version":3,"file":"string-to-utf8-array.mjs","names":[],"sources":["../src/string-to-utf8-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst encoder = new TextEncoder();\n\n/**\n * Convert a string to a utf-8 array\n *\n * @param input - The string to convert\n * @returns The converted utf-8 array\n */\nexport function stringToUtf8Array(input: string): Uint8Array {\n return encoder.encode(input);\n}\n"],"mappings":";AAkBA,MAAM,UAAU,IAAI,aAAa;;;;;;;AAQjC,SAAgB,kBAAkB,OAA2B;AAC3D,QAAO,QAAQ,OAAO,MAAM"}
|
package/dist/to-array.cjs
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/to-array.ts
|
|
3
|
+
/**
|
|
4
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
5
|
+
*
|
|
6
|
+
* @param array - The `Arrayable<T>` to convert
|
|
7
|
+
* @returns An `Array<T>` containing the elements of the input
|
|
8
|
+
*/
|
|
9
|
+
function toArray(array) {
|
|
10
|
+
array = array ?? [];
|
|
11
|
+
return Array.isArray(array) ? array : [array];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.toArray = toArray;
|
package/dist/to-array.mjs
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/to-array.ts
|
|
2
|
+
/**
|
|
3
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
4
|
+
*
|
|
5
|
+
* @param array - The `Arrayable<T>` to convert
|
|
6
|
+
* @returns An `Array<T>` containing the elements of the input
|
|
7
|
+
*/
|
|
8
|
+
function toArray(array) {
|
|
9
|
+
array = array ?? [];
|
|
10
|
+
return Array.isArray(array) ? array : [array];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { toArray };
|
|
2
15
|
//# sourceMappingURL=to-array.mjs.map
|
package/dist/to-array.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-array.mjs","names":[],"sources":["../src/to-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Arrayable } from \"@stryke/types/array\";\nimport type { Nullable } from \"@stryke/types/utilities\";\n\n/**\n * Convert `Arrayable<T>` to `Array<T>`\n *\n * @param array - The `Arrayable<T>` to convert\n * @returns An `Array<T>` containing the elements of the input\n */\nexport function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\n"],"mappings":"AA2BA,SAAgB,
|
|
1
|
+
{"version":3,"file":"to-array.mjs","names":[],"sources":["../src/to-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Arrayable } from \"@stryke/types/array\";\nimport type { Nullable } from \"@stryke/types/utilities\";\n\n/**\n * Convert `Arrayable<T>` to `Array<T>`\n *\n * @param array - The `Arrayable<T>` to convert\n * @returns An `Array<T>` containing the elements of the input\n */\nexport function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\n"],"mappings":";;;;;;;AA2BA,SAAgB,QAAW,OAA0C;AACnE,SAAQ,SAAS,EAAE;AACnB,QAAO,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM"}
|
package/dist/to-string-key.cjs
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/to-string-key.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The value to inspect.
|
|
7
|
+
* @returns Returns the key.
|
|
8
|
+
*/
|
|
9
|
+
function toStringKey(value) {
|
|
10
|
+
if (Object.is(value, -0)) return "-0";
|
|
11
|
+
return value.toString();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.toStringKey = toStringKey;
|
package/dist/to-string-key.mjs
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/to-string-key.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The value to inspect.
|
|
6
|
+
* @returns Returns the key.
|
|
7
|
+
*/
|
|
8
|
+
function toStringKey(value) {
|
|
9
|
+
if (Object.is(value, -0)) return "-0";
|
|
10
|
+
return value.toString();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { toStringKey };
|
|
2
15
|
//# sourceMappingURL=to-string-key.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-string-key.mjs","names":[],"sources":["../src/to-string-key.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @param value - The value to inspect.\n * @returns Returns the key.\n */\nexport function toStringKey(value: number): string | symbol {\n if (Object.is(value, -0)) {\n return \"-0\";\n }\n\n return value.toString();\n}\n"],"mappings":"AAwBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"to-string-key.mjs","names":[],"sources":["../src/to-string-key.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @param value - The value to inspect.\n * @returns Returns the key.\n */\nexport function toStringKey(value: number): string | symbol {\n if (Object.is(value, -0)) {\n return \"-0\";\n }\n\n return value.toString();\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,YAAY,OAAgC;AAC1D,KAAI,OAAO,GAAG,OAAO,GAAG,CACtB,QAAO;AAGT,QAAO,MAAM,UAAU"}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region ../type-checks/src/get-object-tag.ts
|
|
3
|
+
/**
|
|
4
|
+
* Gets the `toStringTag` of `obj`.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The obj to query.
|
|
7
|
+
* @returns Returns the `toStringTag`.
|
|
8
|
+
*/
|
|
9
|
+
const getObjectTag = (value) => {
|
|
10
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
11
|
+
return Object.prototype.toString.call(value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.getObjectTag = getObjectTag;
|