Function: unset()
ts
function unset(object, path): boolean;Removes a nested property from an object by path. 通过路径删除对象中的嵌套属性。
Parameters
| Parameter | Type | Description |
|---|---|---|
object | Record<PropertyKey, unknown> | The target object / 目标对象 |
path | string | readonly PropertyKey[] | The delete path / 删除路径 |
Returns
boolean
true when the property existed and was removed / 属性存在并被删除时返回 true
Example
ts
unset({ a: { b: 1 } }, 'a.b')
// => trueSince
1.2.0