npm.io
1.0.0 • Published 4 years ago

promise.ms

Licence
ISC
Version
1.0.0
Deps
0
Size
1 kB
Vulns
0
Weekly
0

Promise ms

A light-weight package for timing promises


Usage

$ npm install promise.ms
<script src="https://unpkg.com/promise.ms"></script> <!-- Client Side -->

After installing, import promise.ms (nodejs only)

require("promise.ms");

You can use the prototype ms on any promise to get the amount of milliseconds a promise took to resolve

promise.ms((ms) => {
  console.log("time:", ms);
});

// or

(async () => {
  const ms = await promise.ms();
  console.log("time:", ms);
})();

Keywords