Skip to content

Commit

Permalink
Merge pull request #300 from XmiliaH/fix-297
Browse files Browse the repository at this point in the history
Fix error when Promise is deleted
  • Loading branch information
XmiliaH committed Jul 31, 2020
2 parents 77a7681 + 43665f1 commit d12bdbd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/contextify.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ Decontextify.value = (value, traps, deepTraps, flags, mock) => {
} else if (instanceOf(value, WeakMap)) { return Decontextify.instance(value, host.WeakMap, deepTraps, flags, 'WeakMap');
} else if (instanceOf(value, Set)) { return Decontextify.instance(value, host.Set, deepTraps, flags, 'Set');
} else if (instanceOf(value, WeakSet)) { return Decontextify.instance(value, host.WeakSet, deepTraps, flags, 'WeakSet');
} else if (Promise && instanceOf(value, Promise)) { return Decontextify.instance(value, host.Promise, deepTraps, flags, 'Promise');
} else if (typeof Promise === 'function' && instanceOf(value, Promise)) {
return Decontextify.instance(value, host.Promise, deepTraps, flags, 'Promise');
} else if (local.Reflect.getPrototypeOf(value) === null) {
return Decontextify.instance(value, null, deepTraps, flags);
} else {
Expand Down Expand Up @@ -907,7 +908,8 @@ Contextify.value = (value, traps, deepTraps, flags, mock) => {
} else if (instanceOf(value, host.WeakMap)) { return Contextify.instance(value, WeakMap, deepTraps, flags, 'WeakMap');
} else if (instanceOf(value, host.Set)) { return Contextify.instance(value, Set, deepTraps, flags, 'Set');
} else if (instanceOf(value, host.WeakSet)) { return Contextify.instance(value, WeakSet, deepTraps, flags, 'WeakSet');
} else if (instanceOf(value, host.Promise)) { return Contextify.instance(value, Promise, deepTraps, flags, 'Promise');
} else if (typeof Promise === 'function' && instanceOf(value, host.Promise)) {
return Contextify.instance(value, Promise, deepTraps, flags, 'Promise');
} else if (instanceOf(value, host.Buffer)) { return Contextify.instance(value, LocalBuffer, deepTraps, flags, 'Uint8Array');
} else if (host.Reflect.getPrototypeOf(value) === null) {
return Contextify.instance(value, null, deepTraps, flags);
Expand Down

0 comments on commit d12bdbd

Please sign in to comment.