Removes the property at path of object. Mutates in place. Returns true if the property is deleted, else false. Part of Lodash 4.x Object (since 4.0.0).
Pass the object and path or keys shown below. Check whether the helper mutates or returns a new object.
Syntax
Call _.unset. Start with this line.
Lodash
_.unset(object, path)
Call
What it does
_.unset(object, path)
Primary signature.
_.unset(object)
Work with an object’s keys, values, or paths.
Prefer import unset from "lodash/unset" when you want a smaller bundle.
_.unset is a Lodash Object helper (since 4.0.0). It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Closest native cousin is walking a path then using the delete operator; Lodash adds safe path parsing (dot/bracket/array) and a boolean result without throwing on missing parents.
✓ Stable · Lodash 4.x
_.unset()
Available in [email protected] full builds and the lodash/unset modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
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
_.unsetLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import unset from "lodash/unset" for smaller builds. Ideal for stripping nested secrets, temp flags, or draft fields.
Frequently Asked Questions
_.unset(object, path) removes the property at path. It mutates object in place and returns true if the property was removed (or was already absent after resolving the parent), otherwise false when the path cannot be resolved.
Yes. Like _.set, it changes the object you pass. Clone first if you need immutability: _.unset(_.cloneDeep(obj), path).
Same as _.get / _.set: 'a[0].b.c', 'a.0.b.c', or ['a', '0', 'b', 'c'].
Returns false and leaves the object unchanged. No throw.
omit returns a new object and removes top-level keys by name. unset deletes any nested path and mutates in place.
Use import unset from "lodash/unset" or require("lodash/unset"). Full build: import _ from "lodash" then _.unset.