Namespace: template

vef.utils.template

A super module that collects available sub-modules.
Source:

Namespaces

functions

Methods

(static) applyUnitConversion(value, unit, targetUnit, precision) → {String}

Apply unit conversion. At the moment, only the conversion of unit prefixes is supported. There is no conversion of units - with the exception of bits and bytes.
Parameters:
Name Type Description
value String | Number input value
unit String unit of input value
targetUnit String desired output unit. Support of bit to byte conversion and vice versa only
precision String | Number number of digits
Source:
Returns:
converted value and unit
Type
String
Example
['12346789', 'bit', 'B', '3'] -> 1.54 MB
     [0.123, 'm', 'm', '3'] -> 1.23 dm
     [12346789, 'bit/s', 'bit/s', '3'] -> 12.3 Mbit/s

(static) exports.enhanceHTML(element, options) → {HTMLElement}

Apply default enhancements to html generated from resolved Templates
Parameters:
Name Type Description
element HTMLElement
options object
Source:
Returns:
edited element
Type
HTMLElement

(static) exports.resolveTemplate(template, data) → {string}

Fills key-value pairs from object map into the given template string. Fields are defined within curling brakets {}. The resulting string is returned or an empty string if template was not found.
Parameters:
Name Type Description
template string
data object
Source:
Returns:
resolved template
Type
string

(static) resolveComplexTemplate(template, data, options) → {string}

Fills key-value pairs from object map into the given template string. Supports more complex syntax including objects and basic function calls
Parameters:
Name Type Description
template string
data object
options object default: { verbose: false, printUndefined: false, markdown: false, html: false, postProcess: false }
Source:
Returns:
resolved template
Type
string