Members
(static) global
- Source:
Methods
(static) compile(nameopt, templateopt, compileOptsopt, namersopt, operationsopt, directoropt, storeopt, logopt) → {function}
Compiles a locally sandboxed async
template rendering function
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
String
|
<optional> |
The name given to the template (omit to generate via |
||||||||||||||||||||||||
template |
String
|
<optional> |
The template content that will be used by the renderer. Omit to load the template from cache. |
||||||||||||||||||||||||
compileOpts |
TemplateOpts
|
<optional> |
The |
||||||||||||||||||||||||
namers |
Object
|
<optional> |
One or more functions responsible for formatting template names into a full path name
that is consumable by
|
||||||||||||||||||||||||
operations |
Array.<Object>
|
<optional> |
One or more functions and/or objects that will handle render-time read/write operations.
|
||||||||||||||||||||||||
director |
Director
|
<optional> |
The |
||||||||||||||||||||||||
store |
Object
|
<optional> |
The private storage set during compilation that will be passed during naming/reads. Contents should only contain valid JSON properties that can be serialized/deserialized.
|
||||||||||||||||||||||||
log |
Object
|
<optional> |
The log flags that will determine what output will be sent to the
|
Returns:
- Type:
-
function
The rendering async function
that returns a template result string based upon the provided context.
The following arguments apply:
- {Object}
context
The context JSON that can be used as data during rendering - {TemplateOpts}
[renderOptions]
The rendering options that will superceed any compile-time options - {Function}
[readFormatter]
The function that will format read partials during include discovery (if any). The formatting function takes 1 or 2 arguments with the first being the content that will be formatted and the second being theoptions.readFormatOptions
. The returned result should be a valid string. - {Function}
[writeFormatter]
The function that will format written sources during include discovery (if any). The formatting function takes 1 or 2 arguments with the first being the content that will be formatted and the second being theoptions.writeFormatOptions
. The returned result should be a valid string. - {Object}
[sharedStore]
An object used for in-memory storage space that can be shared between rendering functions. This ensures that updated data within a renderer execution will be retained between rendering calls from the same renderer or different renderers that are passed the same shared store.
(static) deserialzeBlock(block, nameopt, isAsyncopt) → {function|undefined}
Deserialzes a code block iwthin a locally sandboxed environment (only global variables are accessible)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
block |
String
|
function
|
The code block to deserialize |
|
name |
String
|
<optional> |
A name that will be given to the function |
isAsync |
Boolean
|
<optional> |
|
Returns:
- Type:
-
function
|undefined
The deserialized function
(static) deserialzeFunction(functionString) → {function|null}
Deserialzes a function string within a locally sandboxed environment (only global variables are accessible)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
functionString |
String
|
The function string to deserialize |
Returns:
- Type:
-
function
|null
The deserialized function
(static) guid(valueopt, hyphenateopt) → {String}
Generates a GUID or formats an existing value
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
String
|
<optional> |
when present, will format the value by add any missing hyphens (if |
|
hyphenate |
Boolean
|
<optional> |
true |
true to include hyphens in generated result |
Returns:
- Type:
-
String
the generated GUID
(static) serialzeFunction(func) → {String|null}
Serialzes a function
- Source:
Parameters:
Name | Type | Description |
---|---|---|
func |
function
|
The function to serialize |
Returns:
- Type:
-
String
|null
The serialized function