-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace getPromise with isPromise (#1255)
* Replace getPromise with isPromise Simplifies logic within the executor, uses the %checks predicate from Flow * Improve flow types
- Loading branch information
Showing
4 changed files
with
60 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict | ||
*/ | ||
|
||
/** | ||
* Returns true if the value acts like a Promise, i.e. has a "then" function, | ||
* otherwise returns false. | ||
*/ | ||
declare function isPromise(value: mixed): boolean %checks(value instanceof | ||
Promise); | ||
|
||
// eslint-disable-next-line no-redeclare | ||
export default function isPromise(value) { | ||
return Boolean(value && typeof value.then === 'function'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters