Skip to content

Commit 3c0cdfe

Browse files
committed
fix(core): use custom equality fn for parameters
1 parent d24c136 commit 3c0cdfe

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

libs/core/src/lib/utils/parameters.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { computed, Signal, Type } from '@angular/core';
22
import { Vector2, Vector3, Vector4 } from 'three';
33
import { NgtVector2, NgtVector3, NgtVector4 } from '../three-types';
44
import { NgtAnyRecord } from '../types';
5+
import { is } from './is';
56

67
type KeysOfType<TObject extends object, TType> = Exclude<
78
{
@@ -15,17 +16,20 @@ export function omit<TObject extends object, TKeys extends (keyof TObject)[]>(
1516
keysToOmit: TKeys,
1617
): Signal<Omit<TObject, TKeys[number]>>;
1718
export function omit(objFn: () => NgtAnyRecord, keysToOmit: string[]) {
18-
return computed(() => {
19-
const obj = objFn();
20-
const result = {} as NgtAnyRecord;
19+
return computed(
20+
() => {
21+
const obj = objFn();
22+
const result = {} as NgtAnyRecord;
2123

22-
for (const key of Object.keys(obj)) {
23-
if (keysToOmit.includes(key)) continue;
24-
Object.assign(result, { [key]: obj[key] });
25-
}
24+
for (const key of Object.keys(obj)) {
25+
if (keysToOmit.includes(key)) continue;
26+
Object.assign(result, { [key]: obj[key] });
27+
}
2628

27-
return result;
28-
});
29+
return result;
30+
},
31+
{ equal: (a, b) => is.equ(a, b, { objects: 'shallow', arrays: 'shallow' }) },
32+
);
2933
}
3034

3135
export function pick<TObject extends object, TKey extends keyof TObject>(

0 commit comments

Comments
 (0)