Skip to content

Commit e3596b7

Browse files
committed
squash: avoid creating throwaway object
1 parent 9420a34 commit e3596b7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/internal/util.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,10 @@ function promisify(original, options = undefined) {
335335
validateFunction(original, 'original');
336336

337337
// No validateObject so .map(util.promisify) can work
338-
if (options == null || typeof options !== 'object') {
339-
options = ObjectCreate(null);
340-
}
341-
const {
342-
resolveArray = false,
343-
resolveObject = null,
344-
callbackPosition = null,
345-
} = options;
338+
const useDefaultOptions = options == null || typeof options !== 'object';
339+
const resolveArray = useDefaultOptions ? false : options.allowArray;
340+
const resolveObject = useDefaultOptions ? null : options.allowFunction;
341+
const callbackPosition = useDefaultOptions ? null : options.nullable;
346342

347343
if (original[kCustomPromisifiedSymbol]) {
348344
const fn = original[kCustomPromisifiedSymbol];

0 commit comments

Comments
 (0)