Skip to content

Commit

Permalink
Merge pull request #11383 from cibernox/update-each-in
Browse files Browse the repository at this point in the history
Update {{each-in}} to use ember-metal/should-display
  • Loading branch information
rwjblue committed Jun 9, 2015
2 parents 6127adb + e17fdb9 commit 205e6df
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/ember-htmlbars/lib/helpers/each-in.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import isEnabled from "ember-metal/features";
import keys from "ember-metal/keys";
import shouldDisplay from "ember-views/streams/should_display";

if (isEnabled('ember-htmlbars-each-in')) {
var shouldDisplay = function(object) {
if (object === undefined || object === null) {
return false;
}

return true;
};

var eachInHelper = function([ object ], hash, blocks) {
if (shouldDisplay(object)) {
for (var prop in object) {
if (!object.hasOwnProperty(prop)) { continue; }
var objKeys, prop, i;
objKeys = object ? keys(object) : [];
if (shouldDisplay(objKeys)) {
for (i = 0; i < objKeys.length; i++) {
prop = objKeys[i];
blocks.template.yieldItem(prop, [prop, object[prop]]);
}
} else if (blocks.inverse.yield) {
Expand Down

0 comments on commit 205e6df

Please sign in to comment.