Skip to main content

Home > @jsplumbtoolkit/core > data

data() function

Extract a value from, or set a value into, an object. This static method can be used outside of Knockle.

Signature:

export declare function data(inObj: Record<string, any>, path: string, value?: any): any;

Parameters

ParameterTypeDescription
inObjRecord<string, any>Object to extract value from or insert value into
pathstringPath to the value to extract/insert, in dotted notation. This syntax also supports array indices, such as foo.bar[3].
valueanyIf provided, this method sets the value. Otherwise it extracts the current value.

Returns:

any

Value for the given path, null if not found.