Skip to content

Commit

Permalink
refactor: check presence using in
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <noreply@github.com>
  • Loading branch information
ferferga committed Nov 8, 2023
1 parent 1759de5 commit 21f7838
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/defu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,7 @@ export const defuArrayFn = createDefu((object, key, currentValue) => {

// Custom version for skipping keys not present in defaults
export const defuSchema = createDefu((schema, key) => {
// Checking for hasOwnProperty is required for compatibility with older browsers
if (
('hasOwn' in Object && !Object.hasOwn(schema, key)) ||
!Object.prototype.hasOwnProperty.call(schema, key)
) {
return true;
}
return false;
return key in schema;
}) as DefuFnSchema;

export type { Defu } from "./types";

0 comments on commit 21f7838

Please sign in to comment.