1. Typed
  2. isPromise

Basic usage

Pass in a value and get a boolean telling you if the value is a Promise. This function is not “bullet proof” because determining if a value is a Promise in javascript is not “bullet proof”. The standard/recommended method is to use Promise.resolve to essentially cast any value, promise or not, into an awaited value. However, this may do in a pinch.

import { isPromise } from 'radash'

isPromise('hello') // => false
isPromise(['hello']) // => false
isPromise(new Promise(res => res())) // => true