Skip to content

Home > @opennd/lib > getValueByPath

getValueByPath() function

使用字符串点操作获取对象中的值

Signature:

typescript
getValueByPath: (object: any, prop: string) => any

Parameters

Parameter

Type

Description

object

any

prop

string

**Returns:**

any

Example

getValueByPath(obj, 'a.b.c')