Comments (7)
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.
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.
+1 @rwjblue What's the alternative right now for composing empty checks with the other truth helpers?
from ember-truth-helpers.
@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.
@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.
I want to pick this up and add it if somebody is not already working on it.
from ember-truth-helpers.
👍 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)
- Helper "not" has wrong value when passing PromiseProxy
- not-eq has unknown reexport HOT 1
- Helper is-empty returns false when passing undefined
- Update to ember-cli-babel@7 HOT 2
- `or` doesn't work the same way as `||` in JavaScript HOT 3
- Update `README` to note that `or`, `and` and `xor` **do** short-circuit HOT 2
- Short-circuit Problem With `SafeString` Using `or` (And Maybe Other Helper)
- Ember Global Deprecation Warning HOT 1
- `or` cant be used when or condition value can be `false` HOT 7
- Project maintenance HOT 4
- Typescript conversion HOT 1
- Can't `npm i` master branch to use with `ember-template-imports` HOT 2
- Cut a release? HOT 12
- Incorrect glint return type for `or` helper in 4.0.0-beta.0 HOT 2
- [QUESTION] `ember-source` compat HOT 3
- `and` returns non-boolean value rather than converting it (which breaks default value logic)
- Document usage with glint additionalSpecialForms config HOT 1
- Memory leaks with `and ` and `or` after they were converted to class based helpers HOT 3
- Importing from package root does not work in classic builds + `.gts`
- Show how to use in template imports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-truth-helpers.