Skip to content

Commit

Permalink
Refactor: emptyObject function in patterns.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsunmin committed Mar 28, 2024
1 parent 154018a commit 396687b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,6 @@ export function shape(pattern: UnknownPattern) {
* .with(P.object.empty(), () => 'will match on empty objects')
*/
const emptyObject = <input>(): GuardExcludeP<input, object, never> => when(
// (value) => value && typeof value === 'object' && Object.keys(value).length === 0,
(value) => {
if (!isObject(value)) return false;

Expand All @@ -1141,7 +1140,7 @@ const objectChainable = <pattern extends Matcher<any, any, any, any, any>>(
pattern: pattern
): ObjectChainable<pattern> =>
Object.assign(chainable(pattern), {
empty: emptyObject,
empty: () => chainable(intersection(pattern, emptyObject())),
}) as any;

/**
Expand Down

0 comments on commit 396687b

Please sign in to comment.