source: imaps-frontend/node_modules/is-date-object/index.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 674 bytes
RevLine 
[d565449]1'use strict';
2
[79a0317]3var callBound = require('call-bound');
4
5var getDay = callBound('Date.prototype.getDay');
6/** @type {import('.')} */
[d565449]7var tryDateObject = function tryDateGetDayCall(value) {
8 try {
[79a0317]9 getDay(value);
[d565449]10 return true;
11 } catch (e) {
12 return false;
13 }
14};
15
[79a0317]16/** @type {(value: unknown) => string} */
17var toStr = callBound('Object.prototype.toString');
[d565449]18var dateClass = '[object Date]';
19var hasToStringTag = require('has-tostringtag/shams')();
20
[79a0317]21/** @type {import('.')} */
[d565449]22module.exports = function isDateObject(value) {
23 if (typeof value !== 'object' || value === null) {
24 return false;
25 }
[79a0317]26 return hasToStringTag ? tryDateObject(value) : toStr(value) === dateClass;
[d565449]27};
Note: See TracBrowser for help on using the repository browser.