Skip to content

Commit

Permalink
check if obj on hasKey is object (#2206)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadmsaadaot authored Sep 18, 2023
1 parent ee33b61 commit 43df78a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions met-web/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { AxiosResponse } from 'axios';

export function hasKey<O>(obj: O, key: PropertyKey): key is keyof O {
if (typeof obj !== 'object' || !obj) {
return false;
}
return key in obj;
}

Expand Down

0 comments on commit 43df78a

Please sign in to comment.