1.0.4 • Published 2 years ago

promise-timing v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Hello!

Thanks for checking out my Repository. This is just a simple Module to measure how long a Promise takes to Resolve while getting the Results of the Promise. If you have any Problems feel free to create an Issue over on Github :D

Usage

const {measurePromise} = require('promise-timing')

await measurePromise(yourPromiseBasedFunction, yourFirstArgument, yourSecondArgument, ...)

The arguments after the promisedBasedFunction will be passed to that function So if you have a function that takes arguemnts like this:

async function testfunction(argumentone, argumenttwo, argumentthree){
  return new Promise((resolve, reject)=>{
    //do heavy stuff
    resolve(yourresult)
  })
}

You could still pass the parameters to the function like this:

await measurePromise(testfunction, argumentone, argumenttwo, argumentthree, etc...)

The Output will look like this:

{ time: 123445, result: "your_result"}

The time is measured in Milliseconds (so 1sec = 1000ms)

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago