Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
27 lines (24 sloc)
692 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getTag from './.internal/getTag.js' | |
import isObjectLike from './isObjectLike.js' | |
import nodeTypes from './.internal/nodeTypes.js' | |
/* Node.js helper references. */ | |
const nodeIsDate = nodeTypes && nodeTypes.isDate | |
/** | |
* Checks if `value` is classified as a `Date` object. | |
* | |
* @since 0.1.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a date object, else `false`. | |
* @example | |
* | |
* isDate(new Date) | |
* // => true | |
* | |
* isDate('Mon April 23 2012') | |
* // => false | |
*/ | |
const isDate = nodeIsDate | |
? (value) => nodeIsDate(value) | |
: (value) => isObjectLike(value) && getTag(value) == '[object Date]' | |
export default isDate |