nunavut.lang.js

Filters for generating javascript. All filters in this module will be available in the template’s global namespace as ln.js.

nunavut.lang.js.filter_to_true_or_false(value: str) → str[source]

Jinja filter that takes in a value, casts it to a bool and emits true or false.

The following example assumes deprecated as an integer 1.

Example:

"deprecated": {{ T.deprecated | ln.js.to_true_or_false }},

Results Example:

"deprecated": false,
Parameters:value (str) – The template value to evaluate.
Returns:true or false