Skip to content

Commit 67f81c2

Browse files
committed
made checks explicit
1 parent b37a3d0 commit 67f81c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/es6-promise/then.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export default function then(onFulfillment, onRejection) {
2121

2222
const { _state } = parent;
2323

24-
if (_state) {
25-
const callback = arguments[_state - 1];
26-
asap(() => invokeCallback(_state, child, callback, parent._result));
27-
} else {
24+
if (_state === PENDING) {
2825
subscribe(parent, child, onFulfillment, onRejection);
26+
} else {
27+
const callback = _state === FULFILLED ? onFulfillment : onRejection;
28+
asap(() => invokeCallback(_state, child, callback, parent._result));
2929
}
3030

3131
return child;

0 commit comments

Comments
 (0)