Skip to content

A Synchronous Promise.resolve. Preserve Sync/Async. Only Go Async If Necessary.

License

Notifications You must be signed in to change notification settings

DanielJDufour/quick-resolve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quick-resolve

A Synchronous Promise.resolve. Preserve Sync/Async. Only Go Async If Necessary.

install

npm install quick-resolve

usage

import quickResolve from "quick-resolve";

let resolved = false;
quickResolve(1).then(num => (resolved = true));
// resolved is true

let resolved = false;
quickResolve(fetch(url)).then(response => (resolved = true));
// resolved is false

let resolved = false;
await quickResolve(fetch(url)).then(response => (resolved = true));
// resolved is true

About

A Synchronous Promise.resolve. Preserve Sync/Async. Only Go Async If Necessary.

Resources

License

Stars

Watchers

Forks

Packages

No packages published