mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added empty() and notEmpty() helpers to the readme
This commit is contained in:
parent
ad5314fd54
commit
eb28b9724b
@ -1292,6 +1292,12 @@ Usage inside template:
|
||||
<div>${data.reverse('reverse test')}</div>
|
||||
```
|
||||
|
||||
Aside from custom helpers that can be built per-project, Marko has some built-in helpers with support for common tasks.
|
||||
|
||||
__empty()/notEmpty()__
|
||||
|
||||
To deal with "empty" data, Marko provides the empty() and notEmpty() helpers. Both helpers can be used to check for empty objects (objects, that are set to null), arrays of length zero or empty strings; empty() returns true for these cases exclusively. Therefore, not all "falsy" JavaScript values are reported as "empty" - e.g.: a boolean value that is set to "false" is not empty, hence notEmpty() would return "true". As their name already suggests, both helpers are contrary to each other.
|
||||
|
||||
## Global Properties
|
||||
|
||||
The `$global` property is used to add data that is available to all templates encountered during rendering by having the data hang off the wrapped writer.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user