@e280/stz 0.2.22 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e280/stz",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "everyday ts fns for everything",
5
5
  "license": "MIT",
6
6
  "author": "Chase Moskal <chasemoskal@gmail.com>",
package/s/data/txt.ts CHANGED
@@ -1,23 +1,18 @@
1
1
 
2
- export const txt = Object.freeze({
3
- fromBytes(bytes: Uint8Array) {
4
- return new TextDecoder().decode(bytes)
5
- },
2
+ const fromBytes = (bytes: Uint8Array) => new TextDecoder().decode(bytes)
3
+ const toBytes = (string: string): Uint8Array => new TextEncoder().encode(string)
6
4
 
7
- toBytes(string: string): Uint8Array {
8
- return new TextEncoder().encode(string)
9
- },
5
+ export function txt(bytes: Uint8Array) {
6
+ return fromBytes(bytes)
7
+ }
8
+ txt.fromBytes = fromBytes
9
+ txt.toBytes = toBytes
10
10
 
11
- /** @deprecated renamed to `fromBytes` */
12
- string(bytes: Uint8Array) {
13
- return txt.fromBytes(bytes)
14
- },
11
+ /** @deprecated renamed to `fromBytes` */
12
+ txt.string = txt.fromBytes
15
13
 
16
- /** @deprecated renamed to `toBytes` */
17
- bytes(string: string) {
18
- return txt.toBytes(string)
19
- },
20
- })
14
+ /** @deprecated renamed to `toBytes` */
15
+ txt.bytes = txt.toBytes
21
16
 
22
17
  /** @deprecated renamed to `txt` */
23
18
  export const Txt = txt
package/x/data/txt.d.ts CHANGED
@@ -1,17 +1,9 @@
1
- export declare const txt: Readonly<{
2
- fromBytes(bytes: Uint8Array): string;
3
- toBytes(string: string): Uint8Array;
4
- /** @deprecated renamed to `fromBytes` */
5
- string(bytes: Uint8Array): string;
6
- /** @deprecated renamed to `toBytes` */
7
- bytes(string: string): Uint8Array<ArrayBufferLike>;
8
- }>;
1
+ export declare function txt(bytes: Uint8Array): string;
2
+ export declare namespace txt {
3
+ var fromBytes: (bytes: Uint8Array) => string;
4
+ var toBytes: (string: string) => Uint8Array;
5
+ var string: (bytes: Uint8Array) => string;
6
+ var bytes: (string: string) => Uint8Array;
7
+ }
9
8
  /** @deprecated renamed to `txt` */
10
- export declare const Txt: Readonly<{
11
- fromBytes(bytes: Uint8Array): string;
12
- toBytes(string: string): Uint8Array;
13
- /** @deprecated renamed to `fromBytes` */
14
- string(bytes: Uint8Array): string;
15
- /** @deprecated renamed to `toBytes` */
16
- bytes(string: string): Uint8Array<ArrayBufferLike>;
17
- }>;
9
+ export declare const Txt: typeof txt;
package/x/data/txt.js CHANGED
@@ -1,19 +1,14 @@
1
- export const txt = Object.freeze({
2
- fromBytes(bytes) {
3
- return new TextDecoder().decode(bytes);
4
- },
5
- toBytes(string) {
6
- return new TextEncoder().encode(string);
7
- },
8
- /** @deprecated renamed to `fromBytes` */
9
- string(bytes) {
10
- return txt.fromBytes(bytes);
11
- },
12
- /** @deprecated renamed to `toBytes` */
13
- bytes(string) {
14
- return txt.toBytes(string);
15
- },
16
- });
1
+ const fromBytes = (bytes) => new TextDecoder().decode(bytes);
2
+ const toBytes = (string) => new TextEncoder().encode(string);
3
+ export function txt(bytes) {
4
+ return fromBytes(bytes);
5
+ }
6
+ txt.fromBytes = fromBytes;
7
+ txt.toBytes = toBytes;
8
+ /** @deprecated renamed to `fromBytes` */
9
+ txt.string = txt.fromBytes;
10
+ /** @deprecated renamed to `toBytes` */
11
+ txt.bytes = txt.toBytes;
17
12
  /** @deprecated renamed to `txt` */
18
13
  export const Txt = txt;
19
14
  //# sourceMappingURL=txt.js.map
package/x/data/txt.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"txt.js","sourceRoot":"","sources":["../../s/data/txt.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC,SAAS,CAAC,KAAiB;QAC1B,OAAO,IAAI,WAAW,EAAE,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