Skip to content

Commit 4789bad

Browse files
committed
fix(ValueObject): fix types, param name
1 parent 8714127 commit 4789bad

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/DeepCompositeSymbol.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { isObject } from './helpers';
66
* an object's entries (key-value pairs).
77
*/
88
// tslint:disable-next-line: variable-name
9-
const DeepCompositeSymbol = ((object: any, filter?: (entry: [string, any]) => boolean) => {
9+
const DeepCompositeSymbol = (object: any, filter?: (entry: [string, any]) => boolean) => {
1010
const entries = filter ? Object.entries(object).filter(filter) : Object.entries(object);
1111
// Recursively replace non-tuple object values with tuples
12-
entries.forEach(x => update(x, filter));
12+
entries.forEach(entry => update(entry, filter));
1313
return Tuple.unsafeSymbol(...flatten(entries));
14-
}) as any;
14+
};
1515

1616
const update = (entry: any, filter?: any) => {
1717
const v = entry[1];

src/ValueObject.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import DeepCompositeSymbol from './DeepCompositeSymbol';
55
* https://github.com/tc39/proposal-record-tuple
66
*/
77
// tslint:disable-next-line: variable-name
8-
const ValueObject = <A extends object>(object: A, keyFilter?: (key: string) => boolean): A => {
9-
const key = DeepCompositeSymbol(object, keyFilter);
8+
const ValueObject = <A extends object>(
9+
object: A,
10+
filter?: (entry: [string, any]) => boolean,
11+
): A => {
12+
const key = DeepCompositeSymbol(object, filter);
1013
if (cache.has(key)) {
1114
return cache.get(key) as A;
1215
}

0 commit comments

Comments
 (0)