Giter VIP home page Giter VIP logo

ember-truth-helpers's Introduction

Ember Truth Helpers Build Status

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

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

ember install ember-truth-helpers

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-empty if (Ember.isEmpty(a)) {{if (is-empty a)}} No
is-equal if (Ember.isEqual(a, b)) {{if (is-equal a b)}} No
* Unlike their JavaScript counterparts, these expressions do not short circuit. For example, with (or a b), even if a is truthy, b will still be evaluated. See this explanation.

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.

Other Helpers

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

ember-truth-helpers's People

Contributors

adjohnson916 avatar dependabot[bot] avatar dhaulagiri avatar ef4 avatar elwayman02 avatar ember-tomster avatar gabrielgrant avatar glavin001 avatar jayphelps avatar jevanlingen avatar jmurphyau avatar keeo avatar lifeart avatar loganrosen avatar mixonic avatar nlfurniss avatar rondale-sc avatar rwjblue avatar rwolffgang avatar sergeastapov avatar snewcomer avatar taras avatar toranb avatar turbo87 avatar xiphiasuvella avatar xuefeng-zhu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.