Giter VIP home page Giter VIP logo

Comments (7)

rwjblue avatar rwjblue commented on July 18, 2024 3

I think adding is-empty seems fine, but I'm not convinced that truthConvert should be changed. Frankly, the idea that this isn't how JS works doesn't really hold much sway to me. HBS is not JS, and Ember fundamentally considers empty arrays as falsey in HBS.

from ember-truth-helpers.

cmackenz avatar cmackenz commented on July 18, 2024 2

It would be nice if this also checked for empty objects {}

Ember.isEmpty returns false when checking {} so I had to create a helper that checked the length of my object's key length. eg., Object.keys(myObject).length === 0 returns true.

or maybe it's better to create a new helper is-empty-object

from ember-truth-helpers.

AndersDJohnson avatar AndersDJohnson commented on July 18, 2024

+1 @rwjblue What's the alternative right now for composing empty checks with the other truth helpers?

from ember-truth-helpers.

btecu avatar btecu commented on July 18, 2024

@adjohnson916 If you know you always have an array (even empty) {{unless myArray.length}} if not, you'll have to chain a check for the array {{if (and myArray myArray.length)

from ember-truth-helpers.

AndersDJohnson avatar AndersDJohnson commented on July 18, 2024

@rwjblue @btecu I've answered my own question about how to handle this currently by adding new unit tests in #27.

from ember-truth-helpers.

devinus avatar devinus commented on July 18, 2024

I want to pick this up and add it if somebody is not already working on it.

from ember-truth-helpers.

drewclauson avatar drewclauson commented on July 18, 2024

👍 on the is-empty using Ember.isEmpty(). I would look into it myself, but haven't done anything with addons quite yet. :-)

from ember-truth-helpers.

Related Issues (20)

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.