Files
lodash/isSet.js
Joyee Cheung 363fef0efc internal: use util.types to migrate DEP0103 in Node.js (#3704)
- 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
2018-03-23 07:31:36 -07:00

28 lines
662 B
JavaScript

import getTag from './.internal/getTag.js'
import nodeTypes from './.internal/nodeTypes.js'
import isObjectLike from './isObjectLike'
/* Node.js helper references. */
const nodeIsSet = nodeTypes && nodeTypes.isSet
/**
* Checks if `value` is classified as a `Set` object.
*
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
* @example
*
* isSet(new Set)
* // => true
*
* isSet(new WeakSet)
* // => false
*/
const isSet = nodeIsSet
? (value) => nodeIsSet(value)
: (value) => isObjectLike(value) && getTag(value) == '[object Set]'
export default isSet