Changeset 79a0317 for imaps-frontend/node_modules/is-date-object/index.js
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/is-date-object/index.js
r0c6b92a r79a0317 1 1 'use strict'; 2 2 3 var getDay = Date.prototype.getDay; 3 var callBound = require('call-bound'); 4 5 var getDay = callBound('Date.prototype.getDay'); 6 /** @type {import('.')} */ 4 7 var tryDateObject = function tryDateGetDayCall(value) { 5 8 try { 6 getDay .call(value);9 getDay(value); 7 10 return true; 8 11 } catch (e) { … … 11 14 }; 12 15 13 var toStr = Object.prototype.toString; 16 /** @type {(value: unknown) => string} */ 17 var toStr = callBound('Object.prototype.toString'); 14 18 var dateClass = '[object Date]'; 15 19 var hasToStringTag = require('has-tostringtag/shams')(); 16 20 21 /** @type {import('.')} */ 17 22 module.exports = function isDateObject(value) { 18 23 if (typeof value !== 'object' || value === null) { 19 24 return false; 20 25 } 21 return hasToStringTag ? tryDateObject(value) : toStr .call(value) === dateClass;26 return hasToStringTag ? tryDateObject(value) : toStr(value) === dateClass; 22 27 };
Note:
See TracChangeset
for help on using the changeset viewer.