mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
- 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
28 lines
665 B
JavaScript
28 lines
665 B
JavaScript
import getTag from './.internal/getTag.js'
|
|
import isObjectLike from './isObjectLike.js'
|
|
import nodeTypes from './.internal/nodeTypes.js'
|
|
|
|
/* Node.js helper references. */
|
|
const nodeIsMap = nodeTypes && nodeTypes.isMap
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Map` object.
|
|
*
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
* @example
|
|
*
|
|
* isMap(new Map)
|
|
* // => true
|
|
*
|
|
* isMap(new WeakMap)
|
|
* // => false
|
|
*/
|
|
const isMap = nodeIsMap
|
|
? (value) => nodeIsMap(value)
|
|
: (value) => isObjectLike(value) && getTag(value) == '[object Map]'
|
|
|
|
export default isMap
|