You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 558B

12345678910111213141516171819202122
  1. 'use strict';
  2. var getDay = Date.prototype.getDay;
  3. var tryDateObject = function tryDateGetDayCall(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) {
  16. return false;
  17. }
  18. return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
  19. };