safety-number-one
v1.0.2
Published
Utility functions to work with Promises, functions and async functions safely by converting throws to Result Tuple types
Maintainers
Readme
safety-number-one
This is a collection of utility functions to work with Promises, functions and async functions safely by converting throws to Result Tuple types.
Usage
This library lets you use the utility functions either by importing or running a side effect to set the utility functions on globalThis so that it can be used anywhere in your codebase.
Use as global value
All global values have the $ prefix.
// In your root entry file
// import module for side effect (makes this available globally)
import "safety-number-one/global";
// In any file in your codebase running after the root entry file
$awaitPromiseSafely(myPromiseValue);Use as module import
import { awaitPromiseSafely } from "safety-number-one";
awaitPromiseSafely(myPromiseValue);