ms.js 451 B

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