@wavy/fn 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -57,7 +57,7 @@ __export(main_exports, {
57
57
  isLetter: () => isLetter,
58
58
  isLocalFile: () => isLocalFile,
59
59
  isNumber: () => isNumber,
60
- lastIndex: () => lastIndex,
60
+ lastIndex: () => lastIndex2,
61
61
  map: () => map,
62
62
  mapToArray: () => mapToArray,
63
63
  maxOf: () => maxOf,
@@ -98,6 +98,91 @@ module.exports = __toCommonJS(main_exports);
98
98
  // src/helper-functions/HelperFunctions.ts
99
99
  var import_types2 = require("@wavy/types");
100
100
 
101
+ // src/helper-functions/components/ObjectConverter.ts
102
+ var import_uuid = require("uuid");
103
+ var import_types = require("@wavy/types");
104
+ var import_console = require("console");
105
+ function fileToLocalFile(file, options) {
106
+ const fileExt = getFileExt(file.name);
107
+ const fileName = (() => {
108
+ if (options?.filename && options.filename.includes(fileExt))
109
+ return options.filename;
110
+ else if (options?.filename) return options.filename.trim() + fileExt;
111
+ return file.name;
112
+ })()?.trim?.();
113
+ const { name: _, size: __, ..._metadata } = file;
114
+ return {
115
+ uid: options?.uid || (0, import_uuid.v4)(),
116
+ description: options?.description,
117
+ ext: fileExt,
118
+ path: options?.filepath || file?.webkitRelativePath,
119
+ typeAlias: options?.typeAlias || run(
120
+ Object.keys(import_types.LOCAL_FILE_MIME_TYPES).find(
121
+ (key) => import_types.LOCAL_FILE_MIME_TYPES[key].includes(file.type)
122
+ ),
123
+ (type) => {
124
+ if (!type) {
125
+ (0, import_console.log)("An unknown file type was found ", file.type);
126
+ return "unknown";
127
+ }
128
+ return type;
129
+ }
130
+ ),
131
+ sizeInBytes: file.size,
132
+ uploadDate: options?.uploadDate === "now" ? Date.now() : options?.uploadDate ?? file?.lastModified,
133
+ name: fileName,
134
+ _metadata
135
+ };
136
+ }
137
+ function localFileToFile(localFile) {
138
+ return {
139
+ name: localFile.name,
140
+ size: localFile.sizeInBytes,
141
+ ...localFile._metadata
142
+ };
143
+ }
144
+ var Overloader = class {
145
+ invoke(...args) {
146
+ if (isFile(args[0])) {
147
+ return fileToLocalFile(...args);
148
+ }
149
+ if (isLocalFile(args[0])) {
150
+ return localFileToFile(...args);
151
+ } else throw new Error(`The arguments supplied are insufficient.`);
152
+ }
153
+ };
154
+ var toObject = new Overloader().invoke;
155
+ var ObjectConverter_default = toObject;
156
+
157
+ // src/helper-functions/components/formatter/FileSizeFormatter.ts
158
+ var FileSizeFormatter = class {
159
+ constructor(bytes) {
160
+ this.bytes = bytes;
161
+ }
162
+ bytes;
163
+ toKb() {
164
+ return { amount: this.scaleUp(this.bytes), unit: "KB" };
165
+ }
166
+ toMb() {
167
+ return { amount: this.scaleUp(this.toKb().amount), unit: "MB" };
168
+ }
169
+ toGb() {
170
+ return { amount: this.scaleUp(this.toMb().amount), unit: "GB" };
171
+ }
172
+ toTb() {
173
+ return { amount: this.scaleUp(this.toGb().amount), unit: "TB" };
174
+ }
175
+ format() {
176
+ const size = [this.toTb(), this.toGb(), this.toMb(), this.toKb()].map(
177
+ (size2) => ({ ...size2, amount: Math.floor(size2.amount) })
178
+ ).find((size2) => size2.amount >= 1);
179
+ return size ? `${size.amount} ${size.unit}` : `${this.bytes} B`;
180
+ }
181
+ scaleUp(bytes) {
182
+ return bytes / 1e3;
183
+ }
184
+ };
185
+
101
186
  // src/helper-functions/components/formatter/number/NumberFormatter.ts
102
187
  var NumberFormatter = class _NumberFormatter {
103
188
  static format(value, format2, options) {
@@ -153,13 +238,12 @@ var NumberFormatter_default = NumberFormatter;
153
238
  var ObjectFormatter = class {
154
239
  static toString = {
155
240
  name: (name) => name ? `${name.first} ${name.last}`.trim() : "no_name",
156
- address: (address, inline) => {
241
+ address: (address, inline = true) => {
157
242
  if (address === void 0) return "no_address";
158
243
  const addressKeys = Object.keys(address).map((k) => k);
159
- const delimiter = (isLast) => !isLast ? "," + (!inline ? "\n" : "") : "";
160
- return addressKeys.map(
161
- (key, idx) => address[key] + delimiter(idx === lastIndex(addressKeys))
162
- ).join("") || "no_address";
244
+ return strictArray(addressKeys.map((key) => address[key])).join(
245
+ "," + inline ? "" : "\n"
246
+ ) || "no_address";
163
247
  }
164
248
  };
165
249
  };
@@ -441,62 +525,6 @@ var TimeManager = class _TimeManager {
441
525
  };
442
526
  var TimeManager_default = TimeManager;
443
527
 
444
- // src/helper-functions/components/ObjectConverter.ts
445
- var import_uuid = require("uuid");
446
- var import_types = require("@wavy/types");
447
- var import_console = require("console");
448
- function fileToLocalFile(file, options) {
449
- const fileExt = getFileExt(file.name);
450
- const fileName = (() => {
451
- if (options?.filename && options.filename.includes(fileExt))
452
- return options.filename;
453
- else if (options?.filename) return options.filename.trim() + fileExt;
454
- return file.name;
455
- })()?.trim?.();
456
- const { name: _, size: __, ..._metadata } = file;
457
- return {
458
- uid: options?.uid || (0, import_uuid.v4)(),
459
- description: options?.description,
460
- ext: fileExt,
461
- path: options?.filepath || file?.webkitRelativePath,
462
- typeAlias: options?.typeAlias || run(
463
- Object.keys(import_types.LOCAL_FILE_MIME_TYPES).find(
464
- (key) => import_types.LOCAL_FILE_MIME_TYPES[key].includes(file.type)
465
- ),
466
- (type) => {
467
- if (!type) {
468
- (0, import_console.log)("An unknown file type was found ", file.type);
469
- return "unknown";
470
- }
471
- return type;
472
- }
473
- ),
474
- sizeInBytes: file.size,
475
- uploadDate: options?.uploadDate === "now" ? Date.now() : options?.uploadDate ?? file?.lastModified,
476
- name: fileName,
477
- _metadata
478
- };
479
- }
480
- function localFileToFile(localFile) {
481
- return {
482
- name: localFile.name,
483
- size: localFile.sizeInBytes,
484
- ...localFile._metadata
485
- };
486
- }
487
- var Overloader = class {
488
- invoke(...args) {
489
- if (isFile(args[0])) {
490
- return fileToLocalFile(...args);
491
- }
492
- if (isLocalFile(args[0])) {
493
- return localFileToFile(...args);
494
- } else throw new Error(`The arguments supplied are insufficient.`);
495
- }
496
- };
497
- var toObject = new Overloader().invoke;
498
- var ObjectConverter_default = toObject;
499
-
500
528
  // src/helper-functions/HelperFunctions.ts
501
529
  var dateFormat = new TimeManager_default().format;
502
530
  var timeDuration = new TimeManager_default().getDuration;
@@ -525,6 +553,8 @@ function format(event, ...args) {
525
553
  return getCaller(toMoney);
526
554
  case "name":
527
555
  return getCaller(nameToString);
556
+ case "file-size":
557
+ return new FileSizeFormatter(args[0]).format();
528
558
  default:
529
559
  return event;
530
560
  }
@@ -583,7 +613,7 @@ function classNameExt(rootClassName) {
583
613
  function range(start, end) {
584
614
  return buildArray(end - start, (i) => i + start);
585
615
  }
586
- function lastIndex(value) {
616
+ function lastIndex2(value) {
587
617
  return value.length - 1;
588
618
  }
589
619
  function buildArray(length, func) {
@@ -594,7 +624,7 @@ function blankSpaces(count2) {
594
624
  }
595
625
  function ordinalIndicator(amount) {
596
626
  const stringifiedAmount = `${amount}`;
597
- const lastIdx = lastIndex(stringifiedAmount);
627
+ const lastIdx = lastIndex2(stringifiedAmount);
598
628
  const lastChar = stringifiedAmount[lastIdx];
599
629
  const secondToLastChar = stringifiedAmount[lastIdx - 1];
600
630
  let indicator;
@@ -843,7 +873,6 @@ async function copyToClipboard(text) {
843
873
  await navigator.clipboard.writeText(text);
844
874
  return { response: "success" };
845
875
  } catch (err) {
846
- console.error("Failed to copy text: ", err);
847
876
  if (err instanceof Error) {
848
877
  return {
849
878
  error: {
@@ -867,7 +896,6 @@ async function readClipboardText() {
867
896
  const text = await navigator.clipboard.readText();
868
897
  return { response: { text: text.trim() } };
869
898
  } catch (err) {
870
- console.error("Failed to read clipboard contents: ", err);
871
899
  return {
872
900
  error: {
873
901
  errorCode: "UNKNOWN",
package/dist/main.d.cts CHANGED
@@ -4,6 +4,18 @@ import { LocalFile, SanitizeFile, KnownFileTypeAlias, TaskResult, FromServer, No
4
4
 
5
5
  type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy | hh:mm A" | "MMM dd, yyyy at hh:mm A" | "MMMM" | "yyyy" | "MMM yyyy" | "mm/dd/yyyy" | "mm/dd/yyyy hh:mm A" | "hh:mm A" | "hh:mm:ss A";
6
6
 
7
+ declare const toObject: {
8
+ (file: File | Pick<File, "size" | "name" | "type" | "webkitRelativePath" | "lastModified">, options?: Partial<{
9
+ uid?: string;
10
+ uploadDate: number | "now";
11
+ description: string;
12
+ filepath: string;
13
+ filename: string;
14
+ typeAlias: LocalFile["typeAlias"];
15
+ }> | undefined): LocalFile;
16
+ (localFile: LocalFile): File;
17
+ };
18
+
7
19
  type NumberFormatterTypes = {
8
20
  formats: "money";
9
21
  options: {
@@ -34,18 +46,6 @@ declare class StringFormatter {
34
46
  static upperFirst(value: string): string;
35
47
  }
36
48
 
37
- declare const toObject: {
38
- (file: File | Pick<File, "name" | "size" | "type" | "webkitRelativePath" | "lastModified">, options?: Partial<{
39
- uid?: string;
40
- uploadDate: number | "now";
41
- description: string;
42
- filepath: string;
43
- filename: string;
44
- typeAlias: LocalFile["typeAlias"];
45
- }> | undefined): LocalFile;
46
- (localFile: LocalFile): File;
47
- };
48
-
49
49
  declare const dateFormat: (time: number | Date | "now", format?: DateFormat) => string;
50
50
  declare const timeDuration: (from: number | "now" | Date, to: number | "now" | Date, options?: {
51
51
  disableRemainder?: boolean;
@@ -62,7 +62,7 @@ declare const pluralize: typeof StringFormatter.pluralize;
62
62
  declare const nameToString: (name: _wavy_types.Name | undefined) => string;
63
63
  declare const addressToString: (address: _wavy_types.Address | undefined, inline?: boolean) => string;
64
64
  declare const toMoney: (value: string | number, options?: NumberFormatterTypes["options"]["money"]) => string;
65
- declare function format<Event extends "date" | "money" | "name" | "address">(event: Event, ...args: Event extends "date" ? Parameters<typeof dateFormat> : Event extends "money" ? Parameters<typeof toMoney> : Event extends "name" ? Parameters<typeof nameToString> : Event extends "address" ? Parameters<typeof addressToString> : never): Event extends "date" ? ReturnType<typeof dateFormat> : Event extends "money" ? ReturnType<typeof toMoney> : Event extends "name" ? ReturnType<typeof nameToString> : Event extends "address" ? ReturnType<typeof addressToString> : never;
65
+ declare function format<Event extends "date" | "money" | "name" | "address" | "file-size">(event: Event, ...args: Event extends "date" ? Parameters<typeof dateFormat> : Event extends "money" ? Parameters<typeof toMoney> : Event extends "name" ? Parameters<typeof nameToString> : Event extends "address" ? Parameters<typeof addressToString> : Event extends "file-size" ? [bytes: number] : never): Event extends "date" | "money" | "name" | "address" | "file-size" ? string : never;
66
66
  declare function sanitizeLocalFile({ _metadata: _, ...file }: LocalFile): SanitizeFile<LocalFile>;
67
67
  declare function isFile(value: unknown): value is File;
68
68
  declare function isLocalFile(value: unknown): value is LocalFile;
package/dist/main.d.ts CHANGED
@@ -4,6 +4,18 @@ import { LocalFile, SanitizeFile, KnownFileTypeAlias, TaskResult, FromServer, No
4
4
 
5
5
  type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy | hh:mm A" | "MMM dd, yyyy at hh:mm A" | "MMMM" | "yyyy" | "MMM yyyy" | "mm/dd/yyyy" | "mm/dd/yyyy hh:mm A" | "hh:mm A" | "hh:mm:ss A";
6
6
 
7
+ declare const toObject: {
8
+ (file: File | Pick<File, "size" | "name" | "type" | "webkitRelativePath" | "lastModified">, options?: Partial<{
9
+ uid?: string;
10
+ uploadDate: number | "now";
11
+ description: string;
12
+ filepath: string;
13
+ filename: string;
14
+ typeAlias: LocalFile["typeAlias"];
15
+ }> | undefined): LocalFile;
16
+ (localFile: LocalFile): File;
17
+ };
18
+
7
19
  type NumberFormatterTypes = {
8
20
  formats: "money";
9
21
  options: {
@@ -34,18 +46,6 @@ declare class StringFormatter {
34
46
  static upperFirst(value: string): string;
35
47
  }
36
48
 
37
- declare const toObject: {
38
- (file: File | Pick<File, "name" | "size" | "type" | "webkitRelativePath" | "lastModified">, options?: Partial<{
39
- uid?: string;
40
- uploadDate: number | "now";
41
- description: string;
42
- filepath: string;
43
- filename: string;
44
- typeAlias: LocalFile["typeAlias"];
45
- }> | undefined): LocalFile;
46
- (localFile: LocalFile): File;
47
- };
48
-
49
49
  declare const dateFormat: (time: number | Date | "now", format?: DateFormat) => string;
50
50
  declare const timeDuration: (from: number | "now" | Date, to: number | "now" | Date, options?: {
51
51
  disableRemainder?: boolean;
@@ -62,7 +62,7 @@ declare const pluralize: typeof StringFormatter.pluralize;
62
62
  declare const nameToString: (name: _wavy_types.Name | undefined) => string;
63
63
  declare const addressToString: (address: _wavy_types.Address | undefined, inline?: boolean) => string;
64
64
  declare const toMoney: (value: string | number, options?: NumberFormatterTypes["options"]["money"]) => string;
65
- declare function format<Event extends "date" | "money" | "name" | "address">(event: Event, ...args: Event extends "date" ? Parameters<typeof dateFormat> : Event extends "money" ? Parameters<typeof toMoney> : Event extends "name" ? Parameters<typeof nameToString> : Event extends "address" ? Parameters<typeof addressToString> : never): Event extends "date" ? ReturnType<typeof dateFormat> : Event extends "money" ? ReturnType<typeof toMoney> : Event extends "name" ? ReturnType<typeof nameToString> : Event extends "address" ? ReturnType<typeof addressToString> : never;
65
+ declare function format<Event extends "date" | "money" | "name" | "address" | "file-size">(event: Event, ...args: Event extends "date" ? Parameters<typeof dateFormat> : Event extends "money" ? Parameters<typeof toMoney> : Event extends "name" ? Parameters<typeof nameToString> : Event extends "address" ? Parameters<typeof addressToString> : Event extends "file-size" ? [bytes: number] : never): Event extends "date" | "money" | "name" | "address" | "file-size" ? string : never;
66
66
  declare function sanitizeLocalFile({ _metadata: _, ...file }: LocalFile): SanitizeFile<LocalFile>;
67
67
  declare function isFile(value: unknown): value is File;
68
68
  declare function isLocalFile(value: unknown): value is LocalFile;
package/dist/main.js CHANGED
@@ -3,6 +3,91 @@ import {
3
3
  LOCAL_FILE_MIME_TYPES as LOCAL_FILE_MIME_TYPES2
4
4
  } from "@wavy/types";
5
5
 
6
+ // src/helper-functions/components/ObjectConverter.ts
7
+ import { v4 } from "uuid";
8
+ import { LOCAL_FILE_MIME_TYPES } from "@wavy/types";
9
+ import { log } from "console";
10
+ function fileToLocalFile(file, options) {
11
+ const fileExt = getFileExt(file.name);
12
+ const fileName = (() => {
13
+ if (options?.filename && options.filename.includes(fileExt))
14
+ return options.filename;
15
+ else if (options?.filename) return options.filename.trim() + fileExt;
16
+ return file.name;
17
+ })()?.trim?.();
18
+ const { name: _, size: __, ..._metadata } = file;
19
+ return {
20
+ uid: options?.uid || v4(),
21
+ description: options?.description,
22
+ ext: fileExt,
23
+ path: options?.filepath || file?.webkitRelativePath,
24
+ typeAlias: options?.typeAlias || run(
25
+ Object.keys(LOCAL_FILE_MIME_TYPES).find(
26
+ (key) => LOCAL_FILE_MIME_TYPES[key].includes(file.type)
27
+ ),
28
+ (type) => {
29
+ if (!type) {
30
+ log("An unknown file type was found ", file.type);
31
+ return "unknown";
32
+ }
33
+ return type;
34
+ }
35
+ ),
36
+ sizeInBytes: file.size,
37
+ uploadDate: options?.uploadDate === "now" ? Date.now() : options?.uploadDate ?? file?.lastModified,
38
+ name: fileName,
39
+ _metadata
40
+ };
41
+ }
42
+ function localFileToFile(localFile) {
43
+ return {
44
+ name: localFile.name,
45
+ size: localFile.sizeInBytes,
46
+ ...localFile._metadata
47
+ };
48
+ }
49
+ var Overloader = class {
50
+ invoke(...args) {
51
+ if (isFile(args[0])) {
52
+ return fileToLocalFile(...args);
53
+ }
54
+ if (isLocalFile(args[0])) {
55
+ return localFileToFile(...args);
56
+ } else throw new Error(`The arguments supplied are insufficient.`);
57
+ }
58
+ };
59
+ var toObject = new Overloader().invoke;
60
+ var ObjectConverter_default = toObject;
61
+
62
+ // src/helper-functions/components/formatter/FileSizeFormatter.ts
63
+ var FileSizeFormatter = class {
64
+ constructor(bytes) {
65
+ this.bytes = bytes;
66
+ }
67
+ bytes;
68
+ toKb() {
69
+ return { amount: this.scaleUp(this.bytes), unit: "KB" };
70
+ }
71
+ toMb() {
72
+ return { amount: this.scaleUp(this.toKb().amount), unit: "MB" };
73
+ }
74
+ toGb() {
75
+ return { amount: this.scaleUp(this.toMb().amount), unit: "GB" };
76
+ }
77
+ toTb() {
78
+ return { amount: this.scaleUp(this.toGb().amount), unit: "TB" };
79
+ }
80
+ format() {
81
+ const size = [this.toTb(), this.toGb(), this.toMb(), this.toKb()].map(
82
+ (size2) => ({ ...size2, amount: Math.floor(size2.amount) })
83
+ ).find((size2) => size2.amount >= 1);
84
+ return size ? `${size.amount} ${size.unit}` : `${this.bytes} B`;
85
+ }
86
+ scaleUp(bytes) {
87
+ return bytes / 1e3;
88
+ }
89
+ };
90
+
6
91
  // src/helper-functions/components/formatter/number/NumberFormatter.ts
7
92
  var NumberFormatter = class _NumberFormatter {
8
93
  static format(value, format2, options) {
@@ -58,13 +143,12 @@ var NumberFormatter_default = NumberFormatter;
58
143
  var ObjectFormatter = class {
59
144
  static toString = {
60
145
  name: (name) => name ? `${name.first} ${name.last}`.trim() : "no_name",
61
- address: (address, inline) => {
146
+ address: (address, inline = true) => {
62
147
  if (address === void 0) return "no_address";
63
148
  const addressKeys = Object.keys(address).map((k) => k);
64
- const delimiter = (isLast) => !isLast ? "," + (!inline ? "\n" : "") : "";
65
- return addressKeys.map(
66
- (key, idx) => address[key] + delimiter(idx === lastIndex(addressKeys))
67
- ).join("") || "no_address";
149
+ return strictArray(addressKeys.map((key) => address[key])).join(
150
+ "," + inline ? "" : "\n"
151
+ ) || "no_address";
68
152
  }
69
153
  };
70
154
  };
@@ -346,62 +430,6 @@ var TimeManager = class _TimeManager {
346
430
  };
347
431
  var TimeManager_default = TimeManager;
348
432
 
349
- // src/helper-functions/components/ObjectConverter.ts
350
- import { v4 } from "uuid";
351
- import { LOCAL_FILE_MIME_TYPES } from "@wavy/types";
352
- import { log } from "console";
353
- function fileToLocalFile(file, options) {
354
- const fileExt = getFileExt(file.name);
355
- const fileName = (() => {
356
- if (options?.filename && options.filename.includes(fileExt))
357
- return options.filename;
358
- else if (options?.filename) return options.filename.trim() + fileExt;
359
- return file.name;
360
- })()?.trim?.();
361
- const { name: _, size: __, ..._metadata } = file;
362
- return {
363
- uid: options?.uid || v4(),
364
- description: options?.description,
365
- ext: fileExt,
366
- path: options?.filepath || file?.webkitRelativePath,
367
- typeAlias: options?.typeAlias || run(
368
- Object.keys(LOCAL_FILE_MIME_TYPES).find(
369
- (key) => LOCAL_FILE_MIME_TYPES[key].includes(file.type)
370
- ),
371
- (type) => {
372
- if (!type) {
373
- log("An unknown file type was found ", file.type);
374
- return "unknown";
375
- }
376
- return type;
377
- }
378
- ),
379
- sizeInBytes: file.size,
380
- uploadDate: options?.uploadDate === "now" ? Date.now() : options?.uploadDate ?? file?.lastModified,
381
- name: fileName,
382
- _metadata
383
- };
384
- }
385
- function localFileToFile(localFile) {
386
- return {
387
- name: localFile.name,
388
- size: localFile.sizeInBytes,
389
- ...localFile._metadata
390
- };
391
- }
392
- var Overloader = class {
393
- invoke(...args) {
394
- if (isFile(args[0])) {
395
- return fileToLocalFile(...args);
396
- }
397
- if (isLocalFile(args[0])) {
398
- return localFileToFile(...args);
399
- } else throw new Error(`The arguments supplied are insufficient.`);
400
- }
401
- };
402
- var toObject = new Overloader().invoke;
403
- var ObjectConverter_default = toObject;
404
-
405
433
  // src/helper-functions/HelperFunctions.ts
406
434
  var dateFormat = new TimeManager_default().format;
407
435
  var timeDuration = new TimeManager_default().getDuration;
@@ -430,6 +458,8 @@ function format(event, ...args) {
430
458
  return getCaller(toMoney);
431
459
  case "name":
432
460
  return getCaller(nameToString);
461
+ case "file-size":
462
+ return new FileSizeFormatter(args[0]).format();
433
463
  default:
434
464
  return event;
435
465
  }
@@ -488,7 +518,7 @@ function classNameExt(rootClassName) {
488
518
  function range(start, end) {
489
519
  return buildArray(end - start, (i) => i + start);
490
520
  }
491
- function lastIndex(value) {
521
+ function lastIndex2(value) {
492
522
  return value.length - 1;
493
523
  }
494
524
  function buildArray(length, func) {
@@ -499,7 +529,7 @@ function blankSpaces(count2) {
499
529
  }
500
530
  function ordinalIndicator(amount) {
501
531
  const stringifiedAmount = `${amount}`;
502
- const lastIdx = lastIndex(stringifiedAmount);
532
+ const lastIdx = lastIndex2(stringifiedAmount);
503
533
  const lastChar = stringifiedAmount[lastIdx];
504
534
  const secondToLastChar = stringifiedAmount[lastIdx - 1];
505
535
  let indicator;
@@ -748,7 +778,6 @@ async function copyToClipboard(text) {
748
778
  await navigator.clipboard.writeText(text);
749
779
  return { response: "success" };
750
780
  } catch (err) {
751
- console.error("Failed to copy text: ", err);
752
781
  if (err instanceof Error) {
753
782
  return {
754
783
  error: {
@@ -772,7 +801,6 @@ async function readClipboardText() {
772
801
  const text = await navigator.clipboard.readText();
773
802
  return { response: { text: text.trim() } };
774
803
  } catch (err) {
775
- console.error("Failed to read clipboard contents: ", err);
776
804
  return {
777
805
  error: {
778
806
  errorCode: "UNKNOWN",
@@ -1000,7 +1028,7 @@ export {
1000
1028
  isLetter,
1001
1029
  isLocalFile,
1002
1030
  isNumber,
1003
- lastIndex,
1031
+ lastIndex2 as lastIndex,
1004
1032
  map,
1005
1033
  mapToArray,
1006
1034
  maxOf,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@wavy/fn",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "main": "./dist/main.js",
5
5
  "module": "./dist/main.cjs",
6
6
  "types": "./dist/main.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsup && node prepend",
9
- "success": "✨ Successfully published package! ✨",
9
+ "success": "echo ✨ Successfully published package! ✨",
10
10
  "publisher": "npm run build && npm version patch && npm publish && npm run success"
11
11
  },
12
12
  "repository": {