Skip to content

Commit

Permalink
use === for null / undefined checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc McIntyre authored and Marc McIntyre committed Apr 1, 2022
1 parent 20c3b8e commit eaf50f5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ export interface MockOpts {

export const mockClear = (mock: MockProxy<any>) => {
for (let key of Object.keys(mock)) {
if (mock[key] == null) continue;

if (mock[key] === null || mock[key] === undefined) {
continue;
}

if (mock[key]._isMockObject) {
mockClear(mock[key]);
}
Expand All @@ -67,7 +69,9 @@ export const mockClear = (mock: MockProxy<any>) => {

export const mockReset = (mock: MockProxy<any>) => {
for (let key of Object.keys(mock)) {
if (mock[key] == null) continue;
if (mock[key] === null || mock[key] === undefined) {
continue;
}

if (mock[key]._isMockObject) {
mockReset(mock[key]);
Expand Down Expand Up @@ -142,7 +146,7 @@ const handler = (opts?: MockOpts) => ({
// @ts-ignore
if (obj instanceof Date && typeof obj[property] === 'function') {
// @ts-ignore
return obj[property].bind(obj)
return obj[property].bind(obj);
}

// @ts-ignore
Expand Down

0 comments on commit eaf50f5

Please sign in to comment.