Skip to content

Commit b844617

Browse files
committed
small cleanup in util
1 parent b37a3d0 commit b844617

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/es6-promise/utils.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
export function objectOrFunction(x) {
2-
return typeof x === 'function' || (typeof x === 'object' && x !== null);
2+
let type = typeof x;
3+
return x !== null && (type === 'object' || type === 'function');
34
}
45

56
export function isFunction(x) {
67
return typeof x === 'function';
78
}
89

910
export function isMaybeThenable(x) {
10-
return typeof x === 'object' && x !== null;
11+
return x !== null && typeof x === 'object';
1112
}
1213

1314
let _isArray;
14-
if (!Array.isArray) {
15-
_isArray = x => Object.prototype.toString.call(x) === '[object Array]';
16-
} else {
15+
if (Array.isArray) {
1716
_isArray = Array.isArray;
17+
} else {
18+
_isArray = x => Object.prototype.toString.call(x) === '[object Array]';
1819
}
1920

2021
export const isArray = _isArray;

0 commit comments

Comments
 (0)