Skip to content

Commit edc569e

Browse files
Link-the-elfMikeRich-Harris
authored
chore: refactor is_promise function (#9794)
* Refactor is_promise function * Update packages/svelte/src/internal/common.js --------- Co-authored-by: Mike <[email protected]> Co-authored-by: Rich Harris <[email protected]>
1 parent dcdd645 commit edc569e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/svelte/src/internal/common.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ export const EMPTY_FUNC = () => {};
1010
* @returns {value is PromiseLike<T>}
1111
*/
1212
export function is_promise(value) {
13-
return (
14-
!!value &&
15-
(typeof value === 'object' || typeof value === 'function') &&
16-
typeof (/** @type {any} */ (value).then) === 'function'
17-
);
13+
return typeof value?.then === 'function';
1814
}
1915

2016
/** @param {Array<() => void>} arr */

0 commit comments

Comments
 (0)