Options
All
  • Public
  • Public/Protected
  • All
Menu

The options that customize the tokenization of the template and the renderer object that is returned

Hierarchy

Index

Properties

Optional Readonly explicit

explicit: undefined | false | true

When set to a truthy value, rendering literally puts a 'null' or 'undefined' for values that are null or undefined. By default it swallows those values to be compatible with Mustache.

Optional maxPathLen

maxPathLen: undefined | number

Maximum allowed path. Set this to a safe value to prevent a bad template from blocking the tokenization unnecessarily

Optional Readonly maxRefDepth

maxRefDepth: undefined | number

Drilling a nested object to get the value assigned with a ref is a relatively expensive computation. Therefore you can set a value of how deep you are expecting a template to go and if the nesting is deeper than that, the computation stops with an error. This prevents a malicious or erroneous template with deep nesting to block the JavaScript event loop. The default is 10.

Optional tags

tags: [string, string]

The string symbols that mark the opening and closing of a path in the template. It should be an array of exactly two distinct strings otherwise an error is thrown. It defaults to ['{{', '}}']

Optional Readonly validatePath

validatePath: undefined | false | true

when set to a truthy value, validates the paths

Optional Readonly validateRef

validateRef: undefined | false | true

When set to a truthy value, we throw a ReferenceError for invalid paths and refs.

  • An invalid ref specifies an array of properties that does not exist in the scope.
  • An invalid path is a string that is parsed to an invalid ref.

When set to a falsy value, we use an empty string for paths and refs that don't exist in the scope.

If a value does not exist in the scope, two things can happen:

  • if validateRef is falsy, the value will be assumed empty string
  • if validateRef is truthy, a ReferenceError will be thrown