mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
- Use require('util').types instead of using process.binding('util')
to get the type checking helpers
- Rename nodeUtil to nodeTypes since that is what it is for
Refs: https://github.com/nodejs/node/pull/18415
28 lines
704 B
JavaScript
28 lines
704 B
JavaScript
import baseGetTag from './.internal/baseGetTag.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) && baseGetTag(value) == '[object Date]'
|
|
|
|
export default isDate
|