MCPcopy Index your code
hub / github.com/tensorflow/tfjs / isPromise

Function isPromise

tfjs-core/src/util_base.ts:739–747  ·  view source on GitHub ↗
(object: any)

Source from the content-addressed store, hash-verified

737 */
738// tslint:disable-next-line: no-any
739export function isPromise(object: any): object is Promise<unknown> {
740 // We chose to not use 'obj instanceOf Promise' for two reasons:
741 // 1. It only reliably works for es6 Promise, not other Promise
742 // implementations.
743 // 2. It doesn't work with framework that uses zone.js. zone.js monkey
744 // patch the async calls, so it is possible the obj (patched) is
745 // comparing to a pre-patched Promise.
746 return object && object.then && typeof object.then === 'function';
747}

Callers 3

getMethod · 0.90
runWithLockFunction · 0.90
f2Function · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…