1.0.0 ā€¢ Published 2 years ago

promise.ms v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Promise ms

npm.io npm.io npm.io

āŒš 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);
})();