Skip to content

Commit 396687b

Browse files
committed
Refactor: emptyObject function in patterns.ts
1 parent 154018a commit 396687b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/patterns.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,6 @@ export function shape(pattern: UnknownPattern) {
11281128
* .with(P.object.empty(), () => 'will match on empty objects')
11291129
*/
11301130
const emptyObject = <input>(): GuardExcludeP<input, object, never> => when(
1131-
// (value) => value && typeof value === 'object' && Object.keys(value).length === 0,
11321131
(value) => {
11331132
if (!isObject(value)) return false;
11341133

@@ -1141,7 +1140,7 @@ const objectChainable = <pattern extends Matcher<any, any, any, any, any>>(
11411140
pattern: pattern
11421141
): ObjectChainable<pattern> =>
11431142
Object.assign(chainable(pattern), {
1144-
empty: emptyObject,
1143+
empty: () => chainable(intersection(pattern, emptyObject())),
11451144
}) as any;
11461145

11471146
/**

0 commit comments

Comments
 (0)