Skip to content

Home > sculp-js > objectGet

objectGet() function

获取对象/数组指定层级下的属性值(现在可用ES6+的可选链?.来替代)

Signature:

typescript
export declare function objectGet(obj: AnyObject | AnyArray | undefined, path: string, strict?: boolean): {
    p: any | undefined;
    k: string | undefined;
    v: any | undefined;
};

Parameters

Parameter

Type

Description

obj

AnyObject | AnyArray | undefined

path

string

strict

boolean

(Optional)

Returns:

{ p: any | undefined; k: string | undefined; v: any | undefined; }

Released under the MIT License.