Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
522 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var getDay = Date.prototype.getDay;
|
---|
4 | var tryDateObject = function tryDateGetDayCall(value) {
|
---|
5 | try {
|
---|
6 | getDay.call(value);
|
---|
7 | return true;
|
---|
8 | } catch (e) {
|
---|
9 | return false;
|
---|
10 | }
|
---|
11 | };
|
---|
12 |
|
---|
13 | var toStr = Object.prototype.toString;
|
---|
14 | var dateClass = '[object Date]';
|
---|
15 | var hasToStringTag = require('has-tostringtag/shams')();
|
---|
16 |
|
---|
17 | module.exports = function isDateObject(value) {
|
---|
18 | if (typeof value !== 'object' || value === null) {
|
---|
19 | return false;
|
---|
20 | }
|
---|
21 | return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.