Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

index.js 551B

1234567891011121314151617181920
  1. 'use strict';
  2. var getDay = Date.prototype.getDay;
  3. var tryDateObject = function tryDateObject(value) {
  4. try {
  5. getDay.call(value);
  6. return true;
  7. } catch (e) {
  8. return false;
  9. }
  10. };
  11. var toStr = Object.prototype.toString;
  12. var dateClass = '[object Date]';
  13. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  14. module.exports = function isDateObject(value) {
  15. if (typeof value !== 'object' || value === null) { return false; }
  16. return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
  17. };