Director
director.repeat(itr, fni) ⇒ String
Directive that drives template loops in the for of or for in flavor
Parameters
| Name | Type | Description |
|---|---|---|
| itr | * | The iterable array, array-like objects, etc. that will be repeated in the form of a for of loopor an iterable non-symbol enumerable whose properties will be traversed in the form of a for in loop |
| fni | * | The function that will return a result for each iteration. for of will pass the item being iteratedand the index of the iteration. for in will pass the key, the value and the index. |
Returns
String— The comulativefniresult
Examples
js
${ repeat(it.metadata, (m, i) => `
<meta name="${ m.name }" content="${ m.content }" />
`)}director.comment() ⇒ String
Tagged directive for consuming template comments
Returns
String— The comment replacement
Examples
js
${ comment` This is a comment that will get consumed` }director.add(func)
Adds a directive function
Parameters
| Name | Type | Description |
|---|---|---|
| func | function | The named directive function to add |
director.directives ⇒ Array.<Object>
Returns
Array.<Object>— An object array that contains{ name:String, code: String }wherenameis the directive name andcodeis the code representation of the directive
director.toString() ⇒ String
Returns
String— The named function directive code
Director.getDirectives(dirOrDirClass) ⇒ Array.<Object>
Extracts class/sub-class Director.directives
Parameters
| Name | Type | Description |
|---|---|---|
| dirOrDirClass | Director | Class.<Director> | The Director instance or class to extract the Director.directives from |
Returns
Array.<Object>— An object array that contains{ name:String, code: String }wherenameis the directive name andcodeis the code representation of the directive
Director.getString(dirOrDirClass) ⇒ String
Extracts class/sub-class Director.toString()
Parameters
| Name | Type | Description |
|---|---|---|
| dirOrDirClass | Class.<Director> | The Director instance or class to extract the Director.directives from |
Returns
String— The named function directive code