@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.
Files changed (64) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/array-buffer-to-string.cjs +19 -1
  3. package/dist/array-buffer-to-string.mjs +18 -1
  4. package/dist/array-buffer-to-string.mjs.map +1 -1
  5. package/dist/buffer-to-string.cjs +14 -1
  6. package/dist/buffer-to-string.mjs +13 -1
  7. package/dist/buffer-to-string.mjs.map +1 -1
  8. package/dist/index.cjs +27 -1
  9. package/dist/index.mjs +13 -1
  10. package/dist/neutral.cjs +23 -1
  11. package/dist/neutral.mjs +11 -1
  12. package/dist/parse-type-definition.cjs +37 -1
  13. package/dist/parse-type-definition.mjs +37 -1
  14. package/dist/parse-type-definition.mjs.map +1 -1
  15. package/dist/string-to-buffer.cjs +27 -1
  16. package/dist/string-to-buffer.mjs +27 -1
  17. package/dist/string-to-buffer.mjs.map +1 -1
  18. package/dist/string-to-uint8-array.cjs +37 -1
  19. package/dist/string-to-uint8-array.mjs +34 -1
  20. package/dist/string-to-uint8-array.mjs.map +1 -1
  21. package/dist/string-to-utf8-array.cjs +15 -1
  22. package/dist/string-to-utf8-array.mjs +14 -1
  23. package/dist/string-to-utf8-array.mjs.map +1 -1
  24. package/dist/to-array.cjs +15 -1
  25. package/dist/to-array.mjs +14 -1
  26. package/dist/to-array.mjs.map +1 -1
  27. package/dist/to-string-key.cjs +15 -1
  28. package/dist/to-string-key.mjs +14 -1
  29. package/dist/to-string-key.mjs.map +1 -1
  30. package/dist/type-checks/src/get-object-tag.cjs +15 -1
  31. package/dist/type-checks/src/get-object-tag.mjs +14 -1
  32. package/dist/type-checks/src/get-object-tag.mjs.map +1 -1
  33. package/dist/type-checks/src/index.cjs +7 -1
  34. package/dist/type-checks/src/index.mjs +9 -1
  35. package/dist/type-checks/src/is-buffer.cjs +12 -1
  36. package/dist/type-checks/src/is-buffer.mjs +11 -1
  37. package/dist/type-checks/src/is-buffer.mjs.map +1 -1
  38. package/dist/type-checks/src/is-collection.cjs +1 -1
  39. package/dist/type-checks/src/is-collection.mjs +3 -1
  40. package/dist/type-checks/src/is-object.cjs +19 -1
  41. package/dist/type-checks/src/is-object.mjs +19 -1
  42. package/dist/type-checks/src/is-object.mjs.map +1 -1
  43. package/dist/type-checks/src/is-plain-object.cjs +64 -1
  44. package/dist/type-checks/src/is-plain-object.mjs +63 -1
  45. package/dist/type-checks/src/is-plain-object.mjs.map +1 -1
  46. package/dist/type-checks/src/is-string.cjs +12 -1
  47. package/dist/type-checks/src/is-string.mjs +11 -1
  48. package/dist/type-checks/src/is-string.mjs.map +1 -1
  49. package/dist/type-checks/src/type-detect.cjs +15 -1
  50. package/dist/type-checks/src/type-detect.mjs +16 -1
  51. package/dist/type-checks/src/type-detect.mjs.map +1 -1
  52. package/dist/uint8-array-to-stream.cjs +49 -1
  53. package/dist/uint8-array-to-stream.mjs +46 -1
  54. package/dist/uint8-array-to-stream.mjs.map +1 -1
  55. package/dist/uint8-array-to-string.cjs +15 -1
  56. package/dist/uint8-array-to-string.mjs +15 -1
  57. package/dist/uint8-array-to-string.mjs.map +1 -1
  58. package/dist/uint8-array-to-string.node.cjs +16 -1
  59. package/dist/uint8-array-to-string.node.mjs +16 -1
  60. package/dist/uint8-array-to-string.node.mjs.map +1 -1
  61. package/dist/utf8-array-to-string.cjs +15 -1
  62. package/dist/utf8-array-to-string.mjs +14 -1
  63. package/dist/utf8-array-to-string.mjs.map +1 -1
  64. 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
- function e(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}exports.arrayBufferToString=e;
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
- function e(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}export{e as arrayBufferToString};
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,EACd,EACQ,CACR,IAAM,EACJ,aAAkB,WACd,EACA,IAAI,WAAW,EAA0B,CACzC,EAAM,EAAM,WAClB,GAAI,EAAM,MACR,OAAO,OAAO,aAAa,MAAM,KAAM,EAA6B,CAEtE,IAAI,EAAS,GACb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,IACvB,GAAU,OAAO,aAAa,EAAM,GAAI,CAE1C,OAAO"}
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
- function e(e){return e.toString(`utf8`)}exports.bufferToString=e;
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
- function e(e){return e.toString(`utf8`)}export{e as bufferToString};
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,EAAe,EAA8B,CAC3D,OAAO,EAAI,SAAS,OAAO"}
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 e=require(`./array-buffer-to-string.cjs`),t=require(`./buffer-to-string.cjs`),n=require(`./parse-type-definition.cjs`),r=require(`./string-to-buffer.cjs`),i=require(`./string-to-uint8-array.cjs`),a=require(`./string-to-utf8-array.cjs`),o=require(`./to-array.cjs`),s=require(`./to-string-key.cjs`),c=require(`./uint8-array-to-stream.cjs`),l=require(`./uint8-array-to-string.node.cjs`),u=require(`./utf8-array-to-string.cjs`);exports.arrayBufferToString=e.arrayBufferToString,exports.base64StringToUint8Array=i.base64StringToUint8Array,exports.binaryStringToUint8Array=i.binaryStringToUint8Array,exports.bufferToString=t.bufferToString,exports.concatUint8Array=c.concatUint8Array,exports.concatUint8ArrayStream=c.concatUint8ArrayStream,exports.parseTypeDefinition=n.parseTypeDefinition,exports.stringToBuffer=r.stringToBuffer,exports.stringToUint8Array=i.stringToUint8Array,exports.stringToUtf8Array=a.stringToUtf8Array,exports.toArray=o.toArray,exports.toStringKey=s.toStringKey,exports.uint8ArrayToStream=c.uint8ArrayToStream,exports.uint8ArrayToString=l.uint8ArrayToString,exports.utf8ArrayToString=u.utf8ArrayToString;
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{arrayBufferToString as e}from"./array-buffer-to-string.mjs";import{bufferToString as t}from"./buffer-to-string.mjs";import{parseTypeDefinition as n}from"./parse-type-definition.mjs";import{stringToBuffer as r}from"./string-to-buffer.mjs";import{base64StringToUint8Array as i,binaryStringToUint8Array as a,stringToUint8Array as o}from"./string-to-uint8-array.mjs";import{stringToUtf8Array as s}from"./string-to-utf8-array.mjs";import{toArray as c}from"./to-array.mjs";import{toStringKey as l}from"./to-string-key.mjs";import{concatUint8Array as u,concatUint8ArrayStream as d,uint8ArrayToStream as f}from"./uint8-array-to-stream.mjs";import{uint8ArrayToString as p}from"./uint8-array-to-string.node.mjs";import{utf8ArrayToString as m}from"./utf8-array-to-string.mjs";export{e as arrayBufferToString,i as base64StringToUint8Array,a as binaryStringToUint8Array,t as bufferToString,u as concatUint8Array,d as concatUint8ArrayStream,n as parseTypeDefinition,r as stringToBuffer,o as stringToUint8Array,s as stringToUtf8Array,c as toArray,l as toStringKey,f as uint8ArrayToStream,p as uint8ArrayToString,m as utf8ArrayToString};
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 e=require(`./array-buffer-to-string.cjs`),t=require(`./parse-type-definition.cjs`),n=require(`./string-to-uint8-array.cjs`),r=require(`./string-to-utf8-array.cjs`),i=require(`./to-array.cjs`),a=require(`./to-string-key.cjs`),o=require(`./uint8-array-to-stream.cjs`),s=require(`./utf8-array-to-string.cjs`),c=require(`./uint8-array-to-string.cjs`);exports.arrayBufferToString=e.arrayBufferToString,exports.base64StringToUint8Array=n.base64StringToUint8Array,exports.binaryStringToUint8Array=n.binaryStringToUint8Array,exports.concatUint8Array=o.concatUint8Array,exports.concatUint8ArrayStream=o.concatUint8ArrayStream,exports.parseTypeDefinition=t.parseTypeDefinition,exports.stringToUint8Array=n.stringToUint8Array,exports.stringToUtf8Array=r.stringToUtf8Array,exports.toArray=i.toArray,exports.toStringKey=a.toStringKey,exports.uint8ArrayToStream=o.uint8ArrayToStream,exports.uint8ArrayToString=c.uint8ArrayToString,exports.utf8ArrayToString=s.utf8ArrayToString;
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{arrayBufferToString as e}from"./array-buffer-to-string.mjs";import{parseTypeDefinition as t}from"./parse-type-definition.mjs";import{base64StringToUint8Array as n,binaryStringToUint8Array as r,stringToUint8Array as i}from"./string-to-uint8-array.mjs";import{stringToUtf8Array as a}from"./string-to-utf8-array.mjs";import{toArray as o}from"./to-array.mjs";import{toStringKey as s}from"./to-string-key.mjs";import{concatUint8Array as c,concatUint8ArrayStream as l,uint8ArrayToStream as u}from"./uint8-array-to-stream.mjs";import{utf8ArrayToString as d}from"./utf8-array-to-string.mjs";import{uint8ArrayToString as f}from"./uint8-array-to-string.mjs";export{e as arrayBufferToString,n as base64StringToUint8Array,r as binaryStringToUint8Array,c as concatUint8Array,l as concatUint8ArrayStream,t as parseTypeDefinition,i as stringToUint8Array,a as stringToUtf8Array,o as toArray,s as toStringKey,u as uint8ArrayToStream,f as uint8ArrayToString,d as utf8ArrayToString};
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 e=require(`./type-checks/src/is-object.cjs`),t=require(`./type-checks/src/is-string.cjs`);require(`./type-checks/src/index.cjs`);const n=n=>{if(t.isString(n)){if(n.includes(`:`)){let e=n.split(`:`);if(e.length>1&&e[0])return{file:e[0],name:e[1]}}if(n.includes(`#`)){let e=n.split(`#`);if(e.length>1&&e[0])return{file:e[0],name:e[1]}}return{file:n}}if(e.isObject(n))return{file:n.file,name:n.name}};exports.parseTypeDefinition=n;
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 as e}from"./type-checks/src/is-object.mjs";import{isString as t}from"./type-checks/src/is-string.mjs";import"./type-checks/src/index.mjs";const n=n=>{if(t(n)){if(n.includes(`:`)){let e=n.split(`:`);if(e.length>1&&e[0])return{file:e[0],name:e[1]}}if(n.includes(`#`)){let e=n.split(`#`);if(e.length>1&&e[0])return{file:e[0],name:e[1]}}return{file:n}}if(e(n))return{file:n.file,name:n.name}};export{n as parseTypeDefinition};
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":"0JA8BA,MAAa,EACX,GAC+B,CAC/B,GAAI,EAAS,EAAM,CAAE,CACnB,GAAI,EAAM,SAAS,IAAI,CAAE,CACvB,IAAM,EAAS,EAAM,MAAM,IAAI,CAC/B,GAAI,EAAO,OAAS,GAAK,EAAO,GAC9B,MAAO,CACL,KAAM,EAAO,GACb,KAAM,EAAO,GACd,CAIL,GAAI,EAAM,SAAS,IAAI,CAAE,CACvB,IAAM,EAAS,EAAM,MAAM,IAAI,CAC/B,GAAI,EAAO,OAAS,GAAK,EAAO,GAC9B,MAAO,CACL,KAAM,EAAO,GACb,KAAM,EAAO,GACd,CAIL,MAAO,CACL,KAAM,EACP,CAGH,GAAI,EAAS,EAAM,CACjB,MAAO,CACL,KAAM,EAAM,KACZ,KAAM,EAAM,KACb"}
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 e=require(`node:buffer`);function t(t){return e.Buffer.from(t,`utf8`)}exports.stringToBuffer=t;
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 as e}from"node:buffer";function t(t){return e.from(t,`utf8`)}export{t as stringToBuffer};
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":"qCAsCA,SAAgB,EAAe,EAAqB,CAClD,OAAO,EAAO,KAAK,EAAK,OAAO"}
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
- function e(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}function t(e){let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}function n(t){return e(atob(t))}exports.base64StringToUint8Array=n,exports.binaryStringToUint8Array=t,exports.stringToUint8Array=e;
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
- function e(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}function t(e){let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}function n(t){return e(atob(t))}export{n as base64StringToUint8Array,t as binaryStringToUint8Array,e as stringToUint8Array};
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,EAAmB,EAA0B,CAC3D,OAAO,WAAW,KAChB,CAAC,GAAG,mBAAmB,EAAK,CAAC,CAAC,IAAI,GAAU,EAAO,YAAY,EAAE,CAAE,CACpE,CASH,SAAgB,EAAyB,EAA4B,CACnE,IAAM,EAAM,EAAO,OACb,EAAM,IAAI,WAAW,EAAI,CAC/B,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,IACvB,EAAI,GAAK,EAAO,WAAW,EAAE,CAE/B,OAAO,EAST,SAAgB,EAAyB,EAA0B,CACjE,OAAO,EAAmB,KAAK,EAAK,CAAC"}
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
- const e=new TextEncoder;function t(t){return e.encode(t)}exports.stringToUtf8Array=t;
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
- const e=new TextEncoder;function t(t){return e.encode(t)}export{t as stringToUtf8Array};
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,EAAU,IAAI,YAQpB,SAAgB,EAAkB,EAA2B,CAC3D,OAAO,EAAQ,OAAO,EAAM"}
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
- function e(e){return e??=[],Array.isArray(e)?e:[e]}exports.toArray=e;
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
- function e(e){return e??=[],Array.isArray(e)?e:[e]}export{e as toArray};
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
@@ -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,EAAW,EAA0C,CAEnE,MADA,KAAiB,EAAE,CACZ,MAAM,QAAQ,EAAM,CAAG,EAAQ,CAAC,EAAM"}
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"}
@@ -1 +1,15 @@
1
- function e(e){return Object.is(e,-0)?`-0`:e.toString()}exports.toStringKey=e;
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;
@@ -1,2 +1,15 @@
1
- function e(e){return Object.is(e,-0)?`-0`:e.toString()}export{e as toStringKey};
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,EAAY,EAAgC,CAK1D,OAJI,OAAO,GAAG,EAAO,GAAG,CACf,KAGF,EAAM,UAAU"}
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
- const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e);exports.getObjectTag=e;
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;