mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
864 B
36 lines
864 B
9 years ago
|
var isObjectLike = require('./isObjectLike');
|
||
10 years ago
|
|
||
|
/** `Object#toString` result references. */
|
||
9 years ago
|
var weakSetTag = '[object WeakSet]';
|
||
10 years ago
|
|
||
9 years ago
|
/** Used for built-in method references. */
|
||
10 years ago
|
var objectProto = Object.prototype;
|
||
|
|
||
|
/**
|
||
9 years ago
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||
10 years ago
|
* of values.
|
||
|
*/
|
||
9 years ago
|
var objectToString = objectProto.toString;
|
||
10 years ago
|
|
||
|
/**
|
||
9 years ago
|
* Checks if `value` is classified as a `WeakSet` object.
|
||
10 years ago
|
*
|
||
|
* @static
|
||
|
* @memberOf _
|
||
|
* @category Lang
|
||
|
* @param {*} value The value to check.
|
||
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||
|
* @example
|
||
|
*
|
||
9 years ago
|
* _.isWeakSet(new WeakSet);
|
||
10 years ago
|
* // => true
|
||
|
*
|
||
9 years ago
|
* _.isWeakSet(new Set);
|
||
10 years ago
|
* // => false
|
||
|
*/
|
||
9 years ago
|
function isWeakSet(value) {
|
||
|
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
module.exports = isWeakSet;
|