@wavy/fn 0.0.29 → 0.0.31

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
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var main_exports = {};
22
22
  __export(main_exports, {
23
23
  addArticle: () => addArticle,
24
+ arrayEquals: () => arrayEquals,
24
25
  arrayWithConst: () => arrayWithConst,
25
26
  asyncRun: () => asyncRun,
26
27
  averageOf: () => averageOf,
@@ -89,6 +90,7 @@ __export(main_exports, {
89
90
  someValuesEmpty: () => someValuesEmpty,
90
91
  sort: () => sort,
91
92
  strictArray: () => strictArray,
93
+ strictArrayEquals: () => strictArrayEquals,
92
94
  stringToSearch: () => stringToSearch,
93
95
  subObjectList: () => subObjectList,
94
96
  sumOf: () => sumOf,
@@ -618,11 +620,31 @@ function isPromise(value) {
618
620
  if (value instanceof Promise) return true;
619
621
  return !!value && (typeof value === "object" || typeof value === "function") && "then" in value && typeof value.then === "function";
620
622
  }
623
+ function arrayEquals(...args) {
624
+ if (!args) return false;
625
+ if (args.length === 0) return false;
626
+ if (args.length === 1) return true;
627
+ return args.every((array, i) => {
628
+ const compareTo = args[i - 1] ?? args[i + 1];
629
+ return array.length === compareTo.length && array.every((item) => compareTo.includes(item));
630
+ });
631
+ }
632
+ function strictArrayEquals(...args) {
633
+ if (!args) return false;
634
+ if (args.length === 0) return false;
635
+ if (args.length === 1) return true;
636
+ return args.every(
637
+ (array, i) => JSON.stringify(args[i - 1] ?? args[i + 1]) === JSON.stringify(array)
638
+ );
639
+ }
621
640
  var parseDate = dateFormat;
622
641
  function parseName(value) {
623
642
  if (typeof value === "string") {
624
- const [first2 = "", last2 = ""] = (value || "").trim().split(" ");
625
- return { first: first2, last: last2 };
643
+ const words = (value || "").trim().split(" ");
644
+ return {
645
+ first: words[0] || "",
646
+ last: words.length <= 1 ? "" : words[words.length - 1] || ""
647
+ };
626
648
  }
627
649
  const { first = "", last = "" } = value || {};
628
650
  return first.trim() + " " + last.trim();
@@ -1025,6 +1047,7 @@ function arrayWithConst(array) {
1025
1047
  // Annotate the CommonJS export names for ESM import in node:
1026
1048
  0 && (module.exports = {
1027
1049
  addArticle,
1050
+ arrayEquals,
1028
1051
  arrayWithConst,
1029
1052
  asyncRun,
1030
1053
  averageOf,
@@ -1093,6 +1116,7 @@ function arrayWithConst(array) {
1093
1116
  someValuesEmpty,
1094
1117
  sort,
1095
1118
  strictArray,
1119
+ strictArrayEquals,
1096
1120
  stringToSearch,
1097
1121
  subObjectList,
1098
1122
  sumOf,
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";
@@ -87,6 +86,8 @@ declare function isFile(value: unknown): value is File;
87
86
  declare function isFileDetails(value: unknown): value is FileDetails;
88
87
  declare function isIterable<T>(value: unknown): value is Iterable<T>;
89
88
  declare function isPromise<T>(value: unknown): value is Promise<T>;
89
+ declare function arrayEquals(...args: any[][]): boolean;
90
+ declare function strictArrayEquals(...args: any[][]): boolean;
90
91
  declare const parseDate: (time: number | Date | "now", format?: DateFormat) => string;
91
92
  declare function parseName<Value extends string | Name>(value: Value): Value extends string ? Name : Value extends Name ? string : never;
92
93
  declare function parseMoney(value: string | number, options?: Parameters<typeof NumberFormatter.toMoney>[1]): string;
@@ -218,4 +219,4 @@ declare function arrayWithConst<T>(array: T[]): {
218
219
  asConst: readonly T[];
219
220
  };
220
221
 
221
- export { addArticle, arrayWithConst, asyncRun, averageOf, blankSpaces, buildArray, camelCaseToLetter, castArray, castReturn, classNameExt, classNameResolver, coerceIn, copyToClipboard, count, dataSearcher, distinct, drop, dropLast, dropLastWhile, dropWhile, format, getCaps, getFileExt, getFilename, getMimeTypes, group, hasIndex, ifDefined, ifEmpty, inRange, indexOf, indices, inferFilename, insertAt, isEmpty, isFile, isFileDetails, isIterable, isLetter, isNumber, isPromise, lastIndex, limit, map, mapToArray, maxOf, minOf, negate, omit, omitNils, ordinalIndicator, overwrite, parseAddress, parseDate, parseFileSize, parseMoney, parseName, pick, pluralize, poll, random, range, readClipboardText, removeAll, repeat, run, someValuesEmpty, sort, strictArray, stringToSearch, subObjectList, sumOf, take, takeLast, takeLastWhile, takeWhile, timeDuration, toNumber, toObject, trimString, undefinedIfEmpty, upperFirst, windowed };
222
+ export { addArticle, arrayEquals, arrayWithConst, asyncRun, averageOf, blankSpaces, buildArray, camelCaseToLetter, castArray, castReturn, classNameExt, classNameResolver, coerceIn, copyToClipboard, count, dataSearcher, distinct, drop, dropLast, dropLastWhile, dropWhile, format, getCaps, getFileExt, getFilename, getMimeTypes, group, hasIndex, ifDefined, ifEmpty, inRange, indexOf, indices, inferFilename, insertAt, isEmpty, isFile, isFileDetails, isIterable, isLetter, isNumber, isPromise, lastIndex, limit, map, mapToArray, maxOf, minOf, negate, omit, omitNils, ordinalIndicator, overwrite, parseAddress, parseDate, parseFileSize, parseMoney, parseName, pick, pluralize, poll, random, range, readClipboardText, removeAll, repeat, run, someValuesEmpty, sort, strictArray, strictArrayEquals, stringToSearch, subObjectList, sumOf, take, takeLast, takeLastWhile, takeWhile, timeDuration, toNumber, toObject, trimString, undefinedIfEmpty, upperFirst, windowed };
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";
@@ -87,6 +86,8 @@ declare function isFile(value: unknown): value is File;
87
86
  declare function isFileDetails(value: unknown): value is FileDetails;
88
87
  declare function isIterable<T>(value: unknown): value is Iterable<T>;
89
88
  declare function isPromise<T>(value: unknown): value is Promise<T>;
89
+ declare function arrayEquals(...args: any[][]): boolean;
90
+ declare function strictArrayEquals(...args: any[][]): boolean;
90
91
  declare const parseDate: (time: number | Date | "now", format?: DateFormat) => string;
91
92
  declare function parseName<Value extends string | Name>(value: Value): Value extends string ? Name : Value extends Name ? string : never;
92
93
  declare function parseMoney(value: string | number, options?: Parameters<typeof NumberFormatter.toMoney>[1]): string;
@@ -218,4 +219,4 @@ declare function arrayWithConst<T>(array: T[]): {
218
219
  asConst: readonly T[];
219
220
  };
220
221
 
221
- export { addArticle, arrayWithConst, asyncRun, averageOf, blankSpaces, buildArray, camelCaseToLetter, castArray, castReturn, classNameExt, classNameResolver, coerceIn, copyToClipboard, count, dataSearcher, distinct, drop, dropLast, dropLastWhile, dropWhile, format, getCaps, getFileExt, getFilename, getMimeTypes, group, hasIndex, ifDefined, ifEmpty, inRange, indexOf, indices, inferFilename, insertAt, isEmpty, isFile, isFileDetails, isIterable, isLetter, isNumber, isPromise, lastIndex, limit, map, mapToArray, maxOf, minOf, negate, omit, omitNils, ordinalIndicator, overwrite, parseAddress, parseDate, parseFileSize, parseMoney, parseName, pick, pluralize, poll, random, range, readClipboardText, removeAll, repeat, run, someValuesEmpty, sort, strictArray, stringToSearch, subObjectList, sumOf, take, takeLast, takeLastWhile, takeWhile, timeDuration, toNumber, toObject, trimString, undefinedIfEmpty, upperFirst, windowed };
222
+ export { addArticle, arrayEquals, arrayWithConst, asyncRun, averageOf, blankSpaces, buildArray, camelCaseToLetter, castArray, castReturn, classNameExt, classNameResolver, coerceIn, copyToClipboard, count, dataSearcher, distinct, drop, dropLast, dropLastWhile, dropWhile, format, getCaps, getFileExt, getFilename, getMimeTypes, group, hasIndex, ifDefined, ifEmpty, inRange, indexOf, indices, inferFilename, insertAt, isEmpty, isFile, isFileDetails, isIterable, isLetter, isNumber, isPromise, lastIndex, limit, map, mapToArray, maxOf, minOf, negate, omit, omitNils, ordinalIndicator, overwrite, parseAddress, parseDate, parseFileSize, parseMoney, parseName, pick, pluralize, poll, random, range, readClipboardText, removeAll, repeat, run, someValuesEmpty, sort, strictArray, strictArrayEquals, stringToSearch, subObjectList, sumOf, take, takeLast, takeLastWhile, takeWhile, timeDuration, toNumber, toObject, trimString, undefinedIfEmpty, upperFirst, windowed };
package/dist/main.js CHANGED
@@ -513,11 +513,31 @@ function isPromise(value) {
513
513
  if (value instanceof Promise) return true;
514
514
  return !!value && (typeof value === "object" || typeof value === "function") && "then" in value && typeof value.then === "function";
515
515
  }
516
+ function arrayEquals(...args) {
517
+ if (!args) return false;
518
+ if (args.length === 0) return false;
519
+ if (args.length === 1) return true;
520
+ return args.every((array, i) => {
521
+ const compareTo = args[i - 1] ?? args[i + 1];
522
+ return array.length === compareTo.length && array.every((item) => compareTo.includes(item));
523
+ });
524
+ }
525
+ function strictArrayEquals(...args) {
526
+ if (!args) return false;
527
+ if (args.length === 0) return false;
528
+ if (args.length === 1) return true;
529
+ return args.every(
530
+ (array, i) => JSON.stringify(args[i - 1] ?? args[i + 1]) === JSON.stringify(array)
531
+ );
532
+ }
516
533
  var parseDate = dateFormat;
517
534
  function parseName(value) {
518
535
  if (typeof value === "string") {
519
- const [first2 = "", last2 = ""] = (value || "").trim().split(" ");
520
- return { first: first2, last: last2 };
536
+ const words = (value || "").trim().split(" ");
537
+ return {
538
+ first: words[0] || "",
539
+ last: words.length <= 1 ? "" : words[words.length - 1] || ""
540
+ };
521
541
  }
522
542
  const { first = "", last = "" } = value || {};
523
543
  return first.trim() + " " + last.trim();
@@ -919,6 +939,7 @@ function arrayWithConst(array) {
919
939
  }
920
940
  export {
921
941
  addArticle,
942
+ arrayEquals,
922
943
  arrayWithConst,
923
944
  asyncRun,
924
945
  averageOf,
@@ -987,6 +1008,7 @@ export {
987
1008
  someValuesEmpty,
988
1009
  sort,
989
1010
  strictArray,
1011
+ strictArrayEquals,
990
1012
  stringToSearch,
991
1013
  subObjectList,
992
1014
  sumOf,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@wavy/fn",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
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"