Added some notes about observed behavior and fixed return types for missing/absent keys.

This commit is contained in:
Tom Alexander
2020-06-14 14:13:33 -04:00
parent 69fa266692
commit 716a110d2e
4 changed files with 18 additions and 4 deletions

View File

@@ -7,3 +7,12 @@ Excerpt from [the DustJS tutorial](https://github.com/linkedin/dustjs/wiki/Dust-
Undefined, 0, empty string - zero
Any other value - length after conversion to string
This appears to be inaccurate (probably out of date because that tutorial was deprecated in favor of [dustjs.com](https://www.dustjs.com/), but the latter is incomplete and lacking any reference to the `@size` helper.
Corrections
-----------
- Booleans are 0, not converted to strings
Oddities
--------
Reference parameters (like `foo="{bar}"`) are usually treated as strings but it seems if it contains ONLY a reference to a value and not anything else, then it is still treated as a number.

View File

@@ -1,6 +1,6 @@
{
"val": {
"pet": "cat",
"name": "fluffy"
"name": "fluffy",
"pet": "cat"
}
}

View File

@@ -1,3 +1,3 @@
The size of val ({val|js|s}) is {@size key=val /}{~n}
The size of "{val}" is {@size key="{val}" /}{~n}
The size of "{~lb}val{~rb}" is {@size key="{val}" /}{~n}
The size with no key is {@size /}{~n}