Skip to content

Commit

Permalink
squash: avoid creating throwaway object
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed May 18, 2022
1 parent 9420a34 commit eba911f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,10 @@ function promisify(original, options = undefined) {
validateFunction(original, 'original');

// No validateObject so .map(util.promisify) can work
if (options == null || typeof options !== 'object') {
options = ObjectCreate(null);
}
const {
resolveArray = false,
resolveObject = null,
callbackPosition = null,
} = options;
const useDefaultOptions = options == null || typeof options !== 'object';
const resolveArray = useDefaultOptions ? false : options.resolveArray;
const resolveObject = useDefaultOptions ? null : options.resolveObject;
const callbackPosition = useDefaultOptions ? null : options.callbackPosition;

if (original[kCustomPromisifiedSymbol]) {
const fn = original[kCustomPromisifiedSymbol];
Expand Down

0 comments on commit eba911f

Please sign in to comment.