Added some notes about observed behavior and fixed return types for missing/absent keys.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"val": {
|
||||
"pet": "cat",
|
||||
"name": "fluffy"
|
||||
"name": "fluffy",
|
||||
"pet": "cat"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user