now.js 619 B

123456789101112131415161718192021222324
  1. var getNative = require('../internal/getNative');
  2. /* Native method references for those with the same name as other `lodash` methods. */
  3. var nativeNow = getNative(Date, 'now');
  4. /**
  5. * Gets the number of milliseconds that have elapsed since the Unix epoch
  6. * (1 January 1970 00:00:00 UTC).
  7. *
  8. * @static
  9. * @memberOf _
  10. * @category Date
  11. * @example
  12. *
  13. * _.defer(function(stamp) {
  14. * console.log(_.now() - stamp);
  15. * }, _.now());
  16. * // => logs the number of milliseconds it took for the deferred function to be invoked
  17. */
  18. var now = nativeNow || function() {
  19. return new Date().getTime();
  20. };
  21. module.exports = now;