chain-able
Version:
interfaces that describe their intentions.
21 lines (19 loc) • 398 B
JavaScript
const toS = require('./toS')
/**
* Checks if `value` is classified as a `Set` object.
*
* @since 4.3.0
* @category Lang
* @param {*} x The value to check.
* @return {boolean} Returns `true` if `value` is a set, else `false`.
*
* @example
*
* isSet(new Set)
* // => true
*
* isSet(new WeakSet)
* // => false
*
*/
module.exports = x => x instanceof Set || toS(x) === '[object Set]'