Skip to content

JavaScript Tool Chest of interesting and useful functions

Notifications You must be signed in to change notification settings

dan3721/js-tool-chest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tool Chest

Collection of interesting and useful JS functions.

For usage see the tests

API

Table of Contents

timeFnPromise

Wraps the specified function in an arrow function that times the promise and appends fulfillment / rejection handler that returns the return value as "ret" and the elapsed time as "elapsedTime".

Parameters

  • fn Function that is exptected to return a Promise.

Examples

const wrappedFn = timeFnPromise(aFunctionThatReturnsAPromise)

wrappedFn()
.then((values)=>{
 const {ret, elapsedTime} = values
 console.log(`ret:[${ret}] elapsedTime:[${elapsedTime}]`)
})

About

JavaScript Tool Chest of interesting and useful functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published