ms.js 460 B

123456789101112131415161718
  1. 'use strict';
  2. var _this = void 0;
  3. var format = require('./format');
  4. var ms = require('ms');
  5. /*
  6. * function ms (info)
  7. * Returns an `info` with a `ms` property. The `ms` property holds the Value
  8. * of the time difference between two calls in milliseconds.
  9. */
  10. module.exports = format(function (info) {
  11. var curr = +new Date();
  12. _this.diff = curr - (_this.prevTime || curr);
  13. _this.prevTime = curr;
  14. info.ms = "+".concat(ms(_this.diff));
  15. return info;
  16. });