debug
In Filters
Debugging filters for rendering template data into output for inspection.
import { dump, jsonify } from '@allons-y/dashly/filters/debug';
dump(value, indent?)
Serialize a value as pretty-printed JSON. Handles circular references, functions, BigInts, Dates, and RegExps so it never throws inside a template.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value
|
unknown |
||
indent
(optional)
|
number |
2 |
Indent width passed to JSON.stringify. |
Returns
string
Examples
// <pre>{{ page | dump }}</pre>
{{ collections.posts[0] | dump(0) }}
// '{"a":1}'
dump({ a: 1 }, 0);
jsonify(value, indent?)
Alias for dump. Some teams prefer the | jsonify name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value
|
unknown |
||
indent
(optional)
|
number |
2 |
Indent width passed to JSON.stringify. |
Returns
string
Examples
// <pre>{{ page | dump }}</pre>
{{ collections.posts[0] | dump(0) }}
// '{"a":1}'
dump({ a: 1 }, 0);