Expand description
JavaScript-like runtime values shared by Brrrty’s template engines.
Re-exports§
pub use tz::Tz;
Modules§
- clock
- The current time, which
SOURCE_DATE_EPOCHcan freeze. - functions
- Calling functions from JavaScript data while a page is built.
- locale
- Node’s default locale, which
toLocaleString()andlocaleCompare()use when they’re given none. - runtime
- What crosses from a JavaScript runtime (the site’s own Node, run by
brrrty-node) into a build: decoded values, function handles, errors, and the trait a build drives the runtime through. - traps
- Reads Brrrty can’t answer from the data alone, noticed while a template renders.
- tz
- Time zones as JavaScript sees them: broken-down time, the offset, the zone’s id and its long name.
Structs§
- Filter
Env - What an engine-neutral filter can see of the build and of the call.
- FnHandle
- A function value that stayed in the JavaScript runtime, to be called later.
- Load
Error - Why a
Loadercould not supply a template.
Enums§
- Collation
Refusal - Why a pair of strings isn’t compared.
- Value
- A JavaScript-like value. Objects keep their insertion order.
Constants§
- REFUSAL_
PREFIX - A filter’s error that starts with this is a refusal: the filter can’t do what was asked exactly, as opposed to the call failing as it would in JavaScript. Nunjucks reports it as unsupported.
Traits§
- Loader
- Finds included templates by name. Returns the resolved path and the source.
Functions§
- array_
index keyas an array index, if it is one written canonically:"7"but not"07","-1"or"4294967295".- console_
format - What
console.log(...values)prints: strings as they are, other values asutil.inspectshows them, joined by spaces. Format specifiers such as%sare not interpreted, and nested values print in the single-line form Node uses when they fit in 80 columns. - eleventy_
filters - Eleventy’s filters, by name.
- is_
js_ whitespace - JavaScript’s whitespace and line terminators: what
\smatches in a regular expression, and whatNumber(text)andtrim()remove. - js_
locale_ compare a.localeCompare(b)in Node with an English locale (en-US, orC): less, equal or greater, as its -1, 0 or 1.Errnames a character whose order in Node can’t be matched.- js_
number_ to_ string - Formats
nexactly as JavaScript’sString(n)does. - js_
string_ to_ number - JavaScript’s
Number(text). - js_
to_ fixed Number.prototype.toFixed(digits), as V8 does it.- js_
to_ locale_ string n.toLocaleString('en-US')with no options, as Node’s ICU prints it: the shortest digits that read back asn(thoseString(n)uses), rounded half away from zero to at most 3 decimals, trailing zeros dropped, and the whole part in groups of three with,.-0(and a negative number that rounds to zero) keeps its-; infinity is∞.- slugify
@sindresorhus/slugify2.2.1 with{ decamelize: false }: 11ty’sslugifyfilter.
Type Aliases§
- Filter
Fn - A filter that a template engine can call: the closure form of
FilterImpl, for filters that carry state, such as one written in a config script. - Filter
Impl - A filter that does not depend on a template engine.