Skip to content

AndrewMusgrave/wrap-with-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wrapWithPromise

Wrap a function with a promise.

Install

npm install wrap-with-promise

Usage

// functions
const a = b => b;
const b = () => {
  throw new Error("General error");
};

// wrapped functions
const newA = wrapWithPromise(a);
const newB = wrapWithPromise(b);

// usage
newA("Hello world").then(data => console.log(data)); // Hello world
newB().catch(err => console.log(err)); // Error: General error

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published