@wavy/fn 0.0.34 → 0.0.36
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 +10 -4
- package/dist/main.d.cts +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +10 -4
- package/package.json +3 -4
package/dist/main.cjs
CHANGED
|
@@ -623,8 +623,10 @@ function getObjectValue(obj, path) {
|
|
|
623
623
|
}, obj);
|
|
624
624
|
}
|
|
625
625
|
function findObjectChanges(source, compareTo, options) {
|
|
626
|
-
const changes = [];
|
|
627
626
|
let entries = Object.entries(source);
|
|
627
|
+
const changes = Object.keys(compareTo).filter(
|
|
628
|
+
(key) => !entries.some(([sourceKey]) => sourceKey === key)
|
|
629
|
+
);
|
|
628
630
|
for (let idx = 0; idx < entries.length; idx++) {
|
|
629
631
|
const [key, value] = entries[idx];
|
|
630
632
|
const comparedValue = getObjectValue(compareTo, key);
|
|
@@ -632,9 +634,12 @@ function findObjectChanges(source, compareTo, options) {
|
|
|
632
634
|
if (Array.isArray(value) && Array.isArray(comparedValue) && !checkArrayEquality(value, comparedValue)) {
|
|
633
635
|
changes.push(key);
|
|
634
636
|
} else if (!!value && !!comparedValue && typeof value === "object" && typeof comparedValue === "object") {
|
|
635
|
-
const newEntries = Object.entries(value).map(
|
|
636
|
-
|
|
637
|
-
|
|
637
|
+
const newEntries = Object.entries(value).map(
|
|
638
|
+
([nestedKey, nestedValue]) => {
|
|
639
|
+
const path = [key, nestedKey].join(".");
|
|
640
|
+
return [path, nestedValue];
|
|
641
|
+
}
|
|
642
|
+
);
|
|
638
643
|
entries.push(...newEntries);
|
|
639
644
|
} else if (JSON.stringify(value) !== JSON.stringify(comparedValue)) {
|
|
640
645
|
changes.push(key);
|
|
@@ -770,6 +775,7 @@ function omit(value, keys) {
|
|
|
770
775
|
function omitNils(value) {
|
|
771
776
|
const result = {};
|
|
772
777
|
if (!value) return value;
|
|
778
|
+
if (Array.isArray(value)) return value.filter((d) => !!d);
|
|
773
779
|
for (const key of Object.keys(value)) {
|
|
774
780
|
const validKey = key;
|
|
775
781
|
const prop = value[validKey];
|
package/dist/main.d.cts
CHANGED
|
@@ -117,7 +117,7 @@ declare function castArray<T>(value: T | T[]): T[];
|
|
|
117
117
|
declare function castReturn<T extends NonFunction<any>>(value: T | (() => T)): T;
|
|
118
118
|
declare function pick<O extends object, K extends keyof O = keyof O>(value: O, keys: K[]): { [Key in K]: O[Key] | null; };
|
|
119
119
|
declare function omit<O extends object, K extends keyof O = keyof O>(value: O, keys: K[]): { [Key in Exclude<keyof O, K>]: O[Key] | null; };
|
|
120
|
-
declare function omitNils<
|
|
120
|
+
declare function omitNils<T extends object | any[]>(value: T): any[] | T;
|
|
121
121
|
declare function map<T>(arr: T[], callback: (value: T, index: number, array: T[], end: () => void) => T): T[];
|
|
122
122
|
declare function getMimeTypes(typeAliases: KnownFileAlias[]): string[];
|
|
123
123
|
declare function classNameResolver(baseClassName: string): (className: string) => string;
|
package/dist/main.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ declare function castArray<T>(value: T | T[]): T[];
|
|
|
117
117
|
declare function castReturn<T extends NonFunction<any>>(value: T | (() => T)): T;
|
|
118
118
|
declare function pick<O extends object, K extends keyof O = keyof O>(value: O, keys: K[]): { [Key in K]: O[Key] | null; };
|
|
119
119
|
declare function omit<O extends object, K extends keyof O = keyof O>(value: O, keys: K[]): { [Key in Exclude<keyof O, K>]: O[Key] | null; };
|
|
120
|
-
declare function omitNils<
|
|
120
|
+
declare function omitNils<T extends object | any[]>(value: T): any[] | T;
|
|
121
121
|
declare function map<T>(arr: T[], callback: (value: T, index: number, array: T[], end: () => void) => T): T[];
|
|
122
122
|
declare function getMimeTypes(typeAliases: KnownFileAlias[]): string[];
|
|
123
123
|
declare function classNameResolver(baseClassName: string): (className: string) => string;
|
package/dist/main.js
CHANGED
|
@@ -513,8 +513,10 @@ function getObjectValue(obj, path) {
|
|
|
513
513
|
}, obj);
|
|
514
514
|
}
|
|
515
515
|
function findObjectChanges(source, compareTo, options) {
|
|
516
|
-
const changes = [];
|
|
517
516
|
let entries = Object.entries(source);
|
|
517
|
+
const changes = Object.keys(compareTo).filter(
|
|
518
|
+
(key) => !entries.some(([sourceKey]) => sourceKey === key)
|
|
519
|
+
);
|
|
518
520
|
for (let idx = 0; idx < entries.length; idx++) {
|
|
519
521
|
const [key, value] = entries[idx];
|
|
520
522
|
const comparedValue = getObjectValue(compareTo, key);
|
|
@@ -522,9 +524,12 @@ function findObjectChanges(source, compareTo, options) {
|
|
|
522
524
|
if (Array.isArray(value) && Array.isArray(comparedValue) && !checkArrayEquality(value, comparedValue)) {
|
|
523
525
|
changes.push(key);
|
|
524
526
|
} else if (!!value && !!comparedValue && typeof value === "object" && typeof comparedValue === "object") {
|
|
525
|
-
const newEntries = Object.entries(value).map(
|
|
526
|
-
|
|
527
|
-
|
|
527
|
+
const newEntries = Object.entries(value).map(
|
|
528
|
+
([nestedKey, nestedValue]) => {
|
|
529
|
+
const path = [key, nestedKey].join(".");
|
|
530
|
+
return [path, nestedValue];
|
|
531
|
+
}
|
|
532
|
+
);
|
|
528
533
|
entries.push(...newEntries);
|
|
529
534
|
} else if (JSON.stringify(value) !== JSON.stringify(comparedValue)) {
|
|
530
535
|
changes.push(key);
|
|
@@ -660,6 +665,7 @@ function omit(value, keys) {
|
|
|
660
665
|
function omitNils(value) {
|
|
661
666
|
const result = {};
|
|
662
667
|
if (!value) return value;
|
|
668
|
+
if (Array.isArray(value)) return value.filter((d) => !!d);
|
|
663
669
|
for (const key of Object.keys(value)) {
|
|
664
670
|
const validKey = key;
|
|
665
671
|
const prop = value[validKey];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavy/fn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"main": "./dist/main.js",
|
|
5
5
|
"module": "./dist/main.cjs",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
@@ -23,18 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/justVibes/literate-succotash#readme",
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"zod": "^4.2.1"
|
|
27
|
-
"@wavy/util": "^0.0.7"
|
|
26
|
+
"zod": "^4.2.1"
|
|
28
27
|
},
|
|
29
28
|
"description": "",
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/node": "^24.5.2",
|
|
32
|
-
"@wavy/util": "^0.0.7",
|
|
33
31
|
"tsup": "^8.5.0",
|
|
34
32
|
"typescript": "^5.9.2",
|
|
35
33
|
"zod": "^4.2.1"
|
|
36
34
|
},
|
|
37
35
|
"dependencies": {
|
|
36
|
+
"@wavy/util": "^0.0.7",
|
|
38
37
|
"uuid": "^13.0.0"
|
|
39
38
|
}
|
|
40
39
|
}
|