UNPKG

605 BJavaScriptView Raw
1import getTag from './_getTag';
2import isObjectLike from './isObjectLike';
3
4/** `Object#toString` result references. */
5var setTag = '[object Set]';
6
7/**
8 * Checks if `value` is classified as a `Set` object.
9 *
10 * @static
11 * @memberOf _
12 * @since 4.3.0
13 * @category Lang
14 * @param {*} value The value to check.
15 * @returns {boolean} Returns `true` if `value` is correctly classified,
16 * else `false`.
17 * @example
18 *
19 * _.isSet(new Set);
20 * // => true
21 *
22 * _.isSet(new WeakSet);
23 * // => false
24 */
25function isSet(value) {
26 return isObjectLike(value) && getTag(value) == setTag;
27}
28
29export default isSet;