@wavy/fn 0.0.28 → 0.0.30

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
@@ -621,15 +621,18 @@ function isPromise(value) {
621
621
  var parseDate = dateFormat;
622
622
  function parseName(value) {
623
623
  if (typeof value === "string") {
624
- const [first2 = "", last2 = ""] = (value || "").trim().split(" ");
625
- return { first: first2, last: last2 };
624
+ const words = (value || "").trim().split(" ");
625
+ return {
626
+ first: words[0] || "",
627
+ last: words.length <= 1 ? "" : words[words.length - 1] || ""
628
+ };
626
629
  }
627
630
  const { first = "", last = "" } = value || {};
628
631
  return first.trim() + " " + last.trim();
629
632
  }
630
- function parseMoney(value) {
631
- if (typeof value === "string") return StringFormatter_default.toMoney(value);
632
- return NumberFormatter_default.toMoney(value);
633
+ function parseMoney(value, options) {
634
+ if (typeof value === "string") return StringFormatter_default.toMoney(value, options);
635
+ return NumberFormatter_default.toMoney(value, options);
633
636
  }
634
637
  function parseAddress(address, ...args) {
635
638
  if (typeof address === "string") {
package/dist/main.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- import "@wavy/util"
2
1
  import { FileDetails, Name, Address, NonFunction, KnownFileAlias, TaskResult } from '@wavy/util';
3
2
 
4
3
  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";
@@ -38,6 +37,11 @@ type NumberFormatterTypes = {
38
37
  };
39
38
  };
40
39
 
40
+ declare class NumberFormatter {
41
+ static format(value: number, format?: NumberFormatterTypes["formats"], options?: NumberFormatterTypes["options"]["money"]): string;
42
+ static toMoney(amount: number | undefined, options?: NumberFormatterTypes["options"]["money"]): string;
43
+ }
44
+
41
45
  declare class StringFormatter {
42
46
  static vowels: string;
43
47
  static caseConverter: {
@@ -84,7 +88,7 @@ declare function isIterable<T>(value: unknown): value is Iterable<T>;
84
88
  declare function isPromise<T>(value: unknown): value is Promise<T>;
85
89
  declare const parseDate: (time: number | Date | "now", format?: DateFormat) => string;
86
90
  declare function parseName<Value extends string | Name>(value: Value): Value extends string ? Name : Value extends Name ? string : never;
87
- declare function parseMoney(value: string | number): string;
91
+ declare function parseMoney(value: string | number, options?: Parameters<typeof NumberFormatter.toMoney>[1]): string;
88
92
  declare function parseAddress<T extends Address | string>(address: T, ...args: T extends string ? [
89
93
  options?: Partial<{
90
94
  /**The value used to separate each field in the string
package/dist/main.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import "@wavy/util"
2
1
  import { FileDetails, Name, Address, NonFunction, KnownFileAlias, TaskResult } from '@wavy/util';
3
2
 
4
3
  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";
@@ -38,6 +37,11 @@ type NumberFormatterTypes = {
38
37
  };
39
38
  };
40
39
 
40
+ declare class NumberFormatter {
41
+ static format(value: number, format?: NumberFormatterTypes["formats"], options?: NumberFormatterTypes["options"]["money"]): string;
42
+ static toMoney(amount: number | undefined, options?: NumberFormatterTypes["options"]["money"]): string;
43
+ }
44
+
41
45
  declare class StringFormatter {
42
46
  static vowels: string;
43
47
  static caseConverter: {
@@ -84,7 +88,7 @@ declare function isIterable<T>(value: unknown): value is Iterable<T>;
84
88
  declare function isPromise<T>(value: unknown): value is Promise<T>;
85
89
  declare const parseDate: (time: number | Date | "now", format?: DateFormat) => string;
86
90
  declare function parseName<Value extends string | Name>(value: Value): Value extends string ? Name : Value extends Name ? string : never;
87
- declare function parseMoney(value: string | number): string;
91
+ declare function parseMoney(value: string | number, options?: Parameters<typeof NumberFormatter.toMoney>[1]): string;
88
92
  declare function parseAddress<T extends Address | string>(address: T, ...args: T extends string ? [
89
93
  options?: Partial<{
90
94
  /**The value used to separate each field in the string
package/dist/main.js CHANGED
@@ -516,15 +516,18 @@ function isPromise(value) {
516
516
  var parseDate = dateFormat;
517
517
  function parseName(value) {
518
518
  if (typeof value === "string") {
519
- const [first2 = "", last2 = ""] = (value || "").trim().split(" ");
520
- return { first: first2, last: last2 };
519
+ const words = (value || "").trim().split(" ");
520
+ return {
521
+ first: words[0] || "",
522
+ last: words.length <= 1 ? "" : words[words.length - 1] || ""
523
+ };
521
524
  }
522
525
  const { first = "", last = "" } = value || {};
523
526
  return first.trim() + " " + last.trim();
524
527
  }
525
- function parseMoney(value) {
526
- if (typeof value === "string") return StringFormatter_default.toMoney(value);
527
- return NumberFormatter_default.toMoney(value);
528
+ function parseMoney(value, options) {
529
+ if (typeof value === "string") return StringFormatter_default.toMoney(value, options);
530
+ return NumberFormatter_default.toMoney(value, options);
528
531
  }
529
532
  function parseAddress(address, ...args) {
530
533
  if (typeof address === "string") {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@wavy/fn",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "main": "./dist/main.js",
5
5
  "module": "./dist/main.cjs",
6
6
  "types": "./dist/main.d.ts",
7
7
  "scripts": {
8
8
  "dev": "npm run build && npm link",
9
- "build": "tsup && node prepend",
9
+ "build": "tsup",
10
10
  "success": "echo ✨ Successfully published package! ✨",
11
11
  "publisher": "npm run build && npm version patch && npm publish && npm run success"
12
12
  },
@@ -22,10 +22,13 @@
22
22
  "url": "https://github.com/justVibes/literate-succotash/issues"
23
23
  },
24
24
  "homepage": "https://github.com/justVibes/literate-succotash#readme",
25
+ "peerDependencies": {
26
+ "zod": "^4.2.1"
27
+ },
25
28
  "description": "",
26
29
  "devDependencies": {
27
30
  "@types/node": "^24.5.2",
28
- "@wavy/util": "^0.0.6",
31
+ "@wavy/util": "^0.0.7",
29
32
  "tsup": "^8.5.0",
30
33
  "typescript": "^5.9.2",
31
34
  "zod": "^4.2.1"