Constructor
new LinkTemplate(templateString, filtersopt)
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
templateString | string | A Moustache template string. | ||
filters | Array | <optional> | [] | An optional array of filter functions. Each element in the array should itself be an array where the first element is a string specifying which fields the filter should be applied to (one of |
- Source
Members
templateString
Get the template string.
- Source
templateString
Set the template string. Should be in Mustache format. All values passed will be coerced to strings.
- Source
Methods
addFilter(fieldName, filterFn) → {LinkTemplate}
Add a filter to be applied to one or all fields.
If an invalid args are passed, the function does not save the filter or throw an error, but it does log a warning.
| Name | Type | Description |
|---|---|---|
fieldName | string | One of |
filterFn | function | the filter function. |
- Source
Returns a reference to self to facilitate function chaining.
- Type:
- LinkTemplate
filtersFor(fieldName) → {Array.<function()>}
A function get the filter functions that should be applied to any given field.
| Name | Type | Description |
|---|---|---|
fieldName | string | one of |
- Source
returns an array of callbacks, which may be empty. An empty array is returned if an invalid field name is passed.
- Type:
- Array.<function()>