Skip to main content

Home > @jsplumb/util > replace

replace() function#

Replace a value inside some object with another value.

Signature:

export declare function replace(inObj: any, path: string, value: any): any;

Parameters#

ParameterTypeDescription
inObjanyObject within which to make the replacement.
pathstringPath to the value to replace. Supports dotted and bracket notation. Eg "foo" means a value with key foo in the root. "foo.bar" means a value with key bar inside a value with key foo. "foo[1]" means the object at index 1 inside a value with key foo.
valueanyValue to replace the original value with.

Returns:

any