Dhaulagiri / ember-truth-helpers

Ember HTMLBars Helpers for {{if}} & {{unless}}: not, and, or, eq & is-array

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ember Truth Helpers Build Status

HTMLBars template helpers for additional truth logic in if and unless statements.

Usage

Helper JavaScript HTMLBars Variable argument count allowed
eq if (a === b) {{if (eq a b)}} No
not-eq if (a !== b) {{if (not-eq a b)}} No
not if (!a) {{if (not a)}} Yes
and if (a && b) {{if (and a b)}} Yes
or if (a || b) {{if (or a b)}}     Yes
xor if (a && !b || !a && b) {{if (xor a b)}} No
gt if (a > b) {{if (gt a b)}} No
gte if (a >= b) {{if (gte a b)}} No
lt if (a < b) {{if (lt a b)}} No
lte if (a <= b) {{if (lte a b)}} No
is-array if (Ember.isArray(a)) {{if (is-array a)}} Yes
is-equal if (Ember.isEqual(a, b)) {{if (is-equal a b)}} No

API

is-equal

is-equal uses Ember.isEqual helper to evaluate equality of two values. eq should be sufficient for most applications. is-equal is necessary when trying to compare a complex object to a primitive value.

Install

  • ember install ember-truth-helpers

Other Helpers

Development

  • git clone https://github.com/jmurphyau/ember-truth-helpers.git
  • cd ember-truth-helpers
  • yarn install
  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • yarn test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://www.ember-cli.com/.

About

Ember HTMLBars Helpers for {{if}} & {{unless}}: not, and, or, eq & is-array

License:MIT License


Languages

Language:JavaScript 94.5%Language:HTML 5.5%