toybox-js-parse-variables

0.2.7 • Public • Published

Convert variables inside %{} markers within strings to functions that return interpolated variables.

Functions

parseData(data, sourceData, templates, defaults, contextPath)Object

Recursively replaces %{variable} references with functions Returns the transformed data object

parseString(string, sourceData, templates, defaults, contextPath)Object

Recursively replace instances of %{somevariable} in a string Returns a string or a function that interpolates variables

interpolateVar(varName, sourceData, templates, defaults, contextPath)Object

Given a variable name and source data, returns the closest matching value in source data, or an empty string

parseData(data, sourceData, templates, defaults, contextPath) ⇒ Object

Recursively replaces %{variable} references with functions Returns the transformed data object

Kind: global function

Param Type
data Object
sourceData Object
templates Object
defaults Object
contextPath String

parseString(string, sourceData, templates, defaults, contextPath) ⇒ Object

Recursively replace instances of %{somevariable} in a string Returns a string or a function that interpolates variables

Kind: global function

Param Type
string String
sourceData Object
templates Object
defaults Object
contextPath String

interpolateVar(varName, sourceData, templates, defaults, contextPath) ⇒ Object

Given a variable name and source data, returns the closest matching value in source data, or an empty string

Kind: global function

Param Type
varName String
sourceData Object
templates Object
defaults Object
contextPath String

Readme

Keywords

Package Sidebar

Install

npm i toybox-js-parse-variables

Weekly Downloads

2

Version

0.2.7

License

X11

Last publish

Collaborators

  • noahrc