mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Bump to v4.14.0.
This commit is contained in:
25
isDate.js
25
isDate.js
@@ -1,17 +1,9 @@
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
import baseIsDate from './_baseIsDate.js';
|
||||
import baseUnary from './_baseUnary.js';
|
||||
import nodeUtil from './_nodeUtil.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var dateTag = '[object Date]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
/* Node.js helper references. */
|
||||
var nodeIsDate = nodeUtil && nodeUtil.isDate;
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Date` object.
|
||||
@@ -21,8 +13,7 @@ var objectToString = objectProto.toString;
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isDate(new Date);
|
||||
@@ -31,8 +22,6 @@ var objectToString = objectProto.toString;
|
||||
* _.isDate('Mon April 23 2012');
|
||||
* // => false
|
||||
*/
|
||||
function isDate(value) {
|
||||
return isObjectLike(value) && objectToString.call(value) == dateTag;
|
||||
}
|
||||
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
|
||||
|
||||
export default isDate;
|
||||
|
||||
Reference in New Issue
Block a user