github-pages-deploy-action/node_modules/is-date-object/index.js

21 lines
551 B
JavaScript
Raw Normal View History

2020-01-28 13:07:56 +08:00
'use strict';
var getDay = Date.prototype.getDay;
2020-03-31 20:57:48 +08:00
var tryDateObject = function tryDateObject(value) {
2020-01-28 13:07:56 +08:00
try {
getDay.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isDateObject(value) {
2020-03-31 20:57:48 +08:00
if (typeof value !== 'object' || value === null) { return false; }
2020-01-28 13:07:56 +08:00
return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
};