Skip to content
This repository was archived by the owner on Aug 21, 2022. It is now read-only.

Commit 6df84d4

Browse files
committed
rebuild 0.4.9
1 parent c0ebb56 commit 6df84d4

12 files changed

+67
-31
lines changed

dev/jscore-ie10.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,24 +585,27 @@ window.Promise || (window.Promise = new function () {
585585
});
586586
}
587587

588+
function isCallable(anything) {
589+
return 'function' == typeof anything;
590+
}
591+
588592
function isPromise(anything) {
589593
return anything instanceof Promise;
590594
}
591595

592596
function isThenable(anything) {
593-
return Object(anything) === anything &&
594-
'function' == typeof anything.then;
597+
return Object(anything) === anything && isCallable(anything.then);
595598
}
596599

597600
function isSettled(promise) {
598601
return promise._fulfilled || promise._rejected;
599602
}
600603

601-
function defaultOnFulfilled(value) {
604+
function identity(value) {
602605
return value;
603606
}
604607

605-
function defaultOnRejected(reason) {
608+
function thrower(reason) {
606609
throw reason;
607610
}
608611

@@ -769,6 +772,9 @@ window.Promise || (window.Promise = new function () {
769772

770773
var promise = this;
771774

775+
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
776+
onRejected = isCallable(onRejected) ? onRejected : thrower;
777+
772778
return new Promise(function (resolve, reject) {
773779

774780
onFulfilled = onFulfilled || defaultOnFulfilled;

dev/jscore-ie9.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,24 +585,27 @@ window.Promise || (window.Promise = new function () {
585585
});
586586
}
587587

588+
function isCallable(anything) {
589+
return 'function' == typeof anything;
590+
}
591+
588592
function isPromise(anything) {
589593
return anything instanceof Promise;
590594
}
591595

592596
function isThenable(anything) {
593-
return Object(anything) === anything &&
594-
'function' == typeof anything.then;
597+
return Object(anything) === anything && isCallable(anything.then);
595598
}
596599

597600
function isSettled(promise) {
598601
return promise._fulfilled || promise._rejected;
599602
}
600603

601-
function defaultOnFulfilled(value) {
604+
function identity(value) {
602605
return value;
603606
}
604607

605-
function defaultOnRejected(reason) {
608+
function thrower(reason) {
606609
throw reason;
607610
}
608611

@@ -769,6 +772,9 @@ window.Promise || (window.Promise = new function () {
769772

770773
var promise = this;
771774

775+
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
776+
onRejected = isCallable(onRejected) ? onRejected : thrower;
777+
772778
return new Promise(function (resolve, reject) {
773779

774780
onFulfilled = onFulfilled || defaultOnFulfilled;

dev/jscore-polyfill-ie10.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,24 +585,27 @@ window.Promise || (window.Promise = new function () {
585585
});
586586
}
587587

588+
function isCallable(anything) {
589+
return 'function' == typeof anything;
590+
}
591+
588592
function isPromise(anything) {
589593
return anything instanceof Promise;
590594
}
591595

592596
function isThenable(anything) {
593-
return Object(anything) === anything &&
594-
'function' == typeof anything.then;
597+
return Object(anything) === anything && isCallable(anything.then);
595598
}
596599

597600
function isSettled(promise) {
598601
return promise._fulfilled || promise._rejected;
599602
}
600603

601-
function defaultOnFulfilled(value) {
604+
function identity(value) {
602605
return value;
603606
}
604607

605-
function defaultOnRejected(reason) {
608+
function thrower(reason) {
606609
throw reason;
607610
}
608611

@@ -769,6 +772,9 @@ window.Promise || (window.Promise = new function () {
769772

770773
var promise = this;
771774

775+
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
776+
onRejected = isCallable(onRejected) ? onRejected : thrower;
777+
772778
return new Promise(function (resolve, reject) {
773779

774780
onFulfilled = onFulfilled || defaultOnFulfilled;

dev/jscore-polyfill-ie9.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,24 +585,27 @@ window.Promise || (window.Promise = new function () {
585585
});
586586
}
587587

588+
function isCallable(anything) {
589+
return 'function' == typeof anything;
590+
}
591+
588592
function isPromise(anything) {
589593
return anything instanceof Promise;
590594
}
591595

592596
function isThenable(anything) {
593-
return Object(anything) === anything &&
594-
'function' == typeof anything.then;
597+
return Object(anything) === anything && isCallable(anything.then);
595598
}
596599

597600
function isSettled(promise) {
598601
return promise._fulfilled || promise._rejected;
599602
}
600603

601-
function defaultOnFulfilled(value) {
604+
function identity(value) {
602605
return value;
603606
}
604607

605-
function defaultOnRejected(reason) {
608+
function thrower(reason) {
606609
throw reason;
607610
}
608611

@@ -769,6 +772,9 @@ window.Promise || (window.Promise = new function () {
769772

770773
var promise = this;
771774

775+
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
776+
onRejected = isCallable(onRejected) ? onRejected : thrower;
777+
772778
return new Promise(function (resolve, reject) {
773779

774780
onFulfilled = onFulfilled || defaultOnFulfilled;

dev/jscore-polyfill.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,24 +1005,27 @@ window.Promise || (window.Promise = new function () {
10051005
});
10061006
}
10071007

1008+
function isCallable(anything) {
1009+
return 'function' == typeof anything;
1010+
}
1011+
10081012
function isPromise(anything) {
10091013
return anything instanceof Promise;
10101014
}
10111015

10121016
function isThenable(anything) {
1013-
return Object(anything) === anything &&
1014-
'function' == typeof anything.then;
1017+
return Object(anything) === anything && isCallable(anything.then);
10151018
}
10161019

10171020
function isSettled(promise) {
10181021
return promise._fulfilled || promise._rejected;
10191022
}
10201023

1021-
function defaultOnFulfilled(value) {
1024+
function identity(value) {
10221025
return value;
10231026
}
10241027

1025-
function defaultOnRejected(reason) {
1028+
function thrower(reason) {
10261029
throw reason;
10271030
}
10281031

@@ -1189,6 +1192,9 @@ window.Promise || (window.Promise = new function () {
11891192

11901193
var promise = this;
11911194

1195+
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
1196+
onRejected = isCallable(onRejected) ? onRejected : thrower;
1197+
11921198
return new Promise(function (resolve, reject) {
11931199

11941200
onFulfilled = onFulfilled || defaultOnFulfilled;

dev/jscore.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,24 +1005,27 @@ window.Promise || (window.Promise = new function () {
10051005
});
10061006
}
10071007

1008+
function isCallable(anything) {
1009+
return 'function' == typeof anything;
1010+
}
1011+
10081012
function isPromise(anything) {
10091013
return anything instanceof Promise;
10101014
}
10111015

10121016
function isThenable(anything) {
1013-
return Object(anything) === anything &&
1014-
'function' == typeof anything.then;
1017+
return Object(anything) === anything && isCallable(anything.then);
10151018
}
10161019

10171020
function isSettled(promise) {
10181021
return promise._fulfilled || promise._rejected;
10191022
}
10201023

1021-
function defaultOnFulfilled(value) {
1024+
function identity(value) {
10221025
return value;
10231026
}
10241027

1025-
function defaultOnRejected(reason) {
1028+
function thrower(reason) {
10261029
throw reason;
10271030
}
10281031

@@ -1189,6 +1192,9 @@ window.Promise || (window.Promise = new function () {
11891192

11901193
var promise = this;
11911194

1195+
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
1196+
onRejected = isCallable(onRejected) ? onRejected : thrower;
1197+
11921198
return new Promise(function (resolve, reject) {
11931199

11941200
onFulfilled = onFulfilled || defaultOnFulfilled;

min/jscore-ie10.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

min/jscore-ie9.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

min/jscore-polyfill-ie10.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)