Skip to content

Commit bb5bbfe

Browse files
committed
[Refactor] use call-bound directly
1 parent fc96301 commit bb5bbfe

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Diff for: browser.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var callBound = require('call-bind/callBound');
3+
var callBound = require('call-bound');
44
var $then = callBound('Promise.prototype.then', true);
55

66
var pFalse = $then && Promise.resolve(false);
@@ -31,6 +31,7 @@ module.exports = function hasDynamicImport() {
3131

3232
return $then(promise, thunkTrue, thunkFalse);
3333
} catch (e) {
34-
return pFalse;
34+
// eslint-disable-next-line no-extra-parens
35+
return /** @type {NonNullable<typeof pFalse>} */ (pFalse);
3536
}
3637
};

Diff for: index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var callBound = require('call-bind/callBound');
3+
var callBound = require('call-bound');
44
var callBind = require('call-bind');
55
var GetIntrinsic = require('get-intrinsic');
66
var $then = callBound('Promise.prototype.then', true);
@@ -41,6 +41,7 @@ module.exports = function hasDynamicImport() {
4141

4242
return $then(importWrapper(), thunkTrue, thunkFalse);
4343
} catch (e) {
44-
return $resolve(false);
44+
// eslint-disable-next-line no-extra-parens
45+
return /** @type {Promise<false>} */ (/** @type {NonNullable<typeof $resolve>} */ ($resolve)(false));
4546
}
4647
};

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
},
9595
"dependencies": {
9696
"call-bind": "^1.0.8",
97+
"call-bound": "^1.0.3",
9798
"get-intrinsic": "^1.2.6"
9899
},
99100
"testling": {

0 commit comments

Comments
 (0)