Function that generates a "then" function for Promise that avoid any empty data by throwing an error.
Input:
import { meaningPromiseOrThrow } from '@helpers4/promise'Promise.resolve('') .then(meaningPromiseOrThrow('My custom error message')) .then(console.log)// => 'My custom error message'
the error message thrown if the data is null, undefined or empty string
null
undefined
Generated using TypeDoc
Function that generates a "then" function for Promise that avoid any empty data by throwing an error.
Input:
Example (es module)