_.isWeakMap is a Lodash Lang helper (available since 4.3.0, stable in 4.x). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. The host must also provide the ES WeakMap built-in (all evergreen engines do).
✓ Stable · Lodash 4.3.0+
_.isWeakMap()
Available in [email protected] full builds and the lodash/isWeakMap modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x + WeakMap
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.isWeakMapLodash 4.3.0+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import isWeakMap from "lodash/isWeakMap" for smaller builds. Native alternative: value instanceof WeakMap (note iframe/realm caveats).
Frequently Asked Questions
_.isWeakMap(value) returns true if value is classified as a WeakMap object, otherwise false. Map, WeakSet, plain objects, and Sets all return false.
Map is a different built-in type with its own brand ([object Map]). Lodash exposes _.isMap for that check.
WeakMap holds keys weakly (entries can be GC’d when the key is unreachable), rejects primitive keys, and is not iterable — no .size, .keys(), or for…of.
Yes. _.isWeakMap(new WeakMap()) is true whether it has entries or not — the check is about type, not contents.
No. Duck-typed objects are not WeakMaps. Lodash looks for a real WeakMap classification, not method names.
Use import isWeakMap from "lodash/isWeakMap" or require("lodash/isWeakMap"). Full build: import _ from "lodash" then _.isWeakMap.