spacekit
A Spacebars helpers kit.
Installation
meteor add evenfrost:spacekit
Features
Spacebars helpers are named after MongoDB comparison and logical query operators.
each $
with $index
, $first
and $last
keys is available.
$Meteor
and $Session
helpers are available.
Spacebars helpers index
- $eq a b
- $ne a b
- $gt a b
- $gte a b
- $lt a b
- $lte a b
- $in arr b
- $nin arr b
- $and ...
- $or ...
- $nor ...
- $exists a
- $eval str
- $ iterable
- $Meteor
- $Session
Description
$eq a b
Returns true if a
equals b
.
$ne a b
Returns true if a
doesn't equal b
.
$gt a b
Returns true if a
is greater than b
.
$gte a b
Returns true if a
is greater than or equals b
.
$lt a b
Returns true if a
is less than b
.
$lte a b
Returns true if a
is less than or equals b
.
$in arr b
Returns true if arr
contains b
.
arr
is array provided either as helper variable or raw string ( e.g. '["foo", 42, "bar"]'
).
$nin arr b
Returns true if arr
doesn't contain b
.
$and ...
Returns true if all arguments are truthy.
$or ...
Returns true if at least one argument is truthy.
$nor ...
Returns true if none of arguments are truthy.
$exists a
Returns true if a
exists (is not undefined).
$eval str
Experimental. Evaluates a string expression and returns its result. Should be used carefully.
$ iterable
Iterates over array, object or cursor.
Provides additional inner helpers such as $first
, $last
and $index
.
$Meteor
Provides access to any property of Meteor object that is available on the client.
$Session
An object which keys are currently defined Session
variables.
{{$Session.a}}
is the same as Session.get('a')
outside helpers. Is reactive.
Can be combined with other helpers.