Skip to main content

compileJSONPaths

Stentor API Reference


Stentor API Reference / stentor-utils/src / compileJSONPaths

Function: compileJSONPaths()

Call Signature​

compileJSONPaths(responseOutput, object, replaceWhenUndefined?): string

Defined in: packages/stentor-utils/src/compilers/compileJSONPaths.ts:37

Compiles all instances of a template with the provided string by looking up the JSON path within the provided object.

For example, when passed "${greeting} ${foo.name}, how are you?" and { greeting: "Hello", foo: {name: "Bob" }} will be compiled to "Hello Bob, how are you?"

Parameters​

responseOutput​

string

object​

object

replaceWhenUndefined?​

boolean

Returns​

string

Deprecated​

Use class Compiler, which handles both JSONPaths & Slots

Call Signature​

compileJSONPaths(responseOutput, object, replaceWhenUndefined?): ResponseOutput

Defined in: packages/stentor-utils/src/compilers/compileJSONPaths.ts:38

Compiles all instances of a template with the provided string by looking up the JSON path within the provided object.

For example, when passed "${greeting} ${foo.name}, how are you?" and { greeting: "Hello", foo: {name: "Bob" }} will be compiled to "Hello Bob, how are you?"

Parameters​

responseOutput​

ResponseOutput

object​

object

replaceWhenUndefined?​

boolean

Returns​

ResponseOutput

Deprecated​

Use class Compiler, which handles both JSONPaths & Slots