<story><title>Ember.js 2.7 and 2.8 beta released</title><url>http://emberjs.com/blog/2016/07/25/ember-2-7-and-2-8-beta-released.html</url></story><parent_chain><item><author>Longwelwind</author><text>Over-reliance on strings is a pattern that I&amp;#x27;ve seen a lot in the Javascript environment. For example:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  var arr = [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }];
  arr.uniqBy(&amp;#x27;value&amp;#x27;);  &amp;#x2F;&amp;#x2F; [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }]
&lt;/code&gt;&lt;/pre&gt;
Wouldn&amp;#x27;t be better to do something like this ?&lt;p&gt;&lt;pre&gt;&lt;code&gt;  var arr = [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }];
  arr.uniqBy(element =&amp;gt; element.value);  &amp;#x2F;&amp;#x2F; [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }]
&lt;/code&gt;&lt;/pre&gt;
You have to write a little bit more (I could have used &amp;quot;e&amp;quot; instead of &amp;quot;element&amp;quot;, though) but if you do a typo in the name of the property, it can be caught by a linter&amp;#x2F;compiler, and you don&amp;#x27;t get the feeling you&amp;#x27;re relying on Vodoo magic.&lt;p&gt;Are there any advantages to use a string instead of a &amp;quot;static&amp;quot; way of accessing the property ?</text></item></parent_chain><comment><author>orf</author><text>EmberJS uses strings as property paths. You can use &amp;#x27;foo.bar.firstObject.baz&amp;#x27; as a unique key the same as any other function that takes a property paths (like a computed property). In Ember you write a &lt;i&gt;lot&lt;/i&gt; of these so any small overhead like a lambda is a bit of a waste.&lt;p&gt;Also I don&amp;#x27;t think ember would work with functions instead of strings, the whole point of the strings is that the unique function is &lt;i&gt;only called when one of the items in the property paths changes&lt;/i&gt;, and you can&amp;#x27;t get that from functions. You can only evaluate them.</text></comment>
<story><title>Ember.js 2.7 and 2.8 beta released</title><url>http://emberjs.com/blog/2016/07/25/ember-2-7-and-2-8-beta-released.html</url></story><parent_chain><item><author>Longwelwind</author><text>Over-reliance on strings is a pattern that I&amp;#x27;ve seen a lot in the Javascript environment. For example:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  var arr = [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }];
  arr.uniqBy(&amp;#x27;value&amp;#x27;);  &amp;#x2F;&amp;#x2F; [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }]
&lt;/code&gt;&lt;/pre&gt;
Wouldn&amp;#x27;t be better to do something like this ?&lt;p&gt;&lt;pre&gt;&lt;code&gt;  var arr = [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }];
  arr.uniqBy(element =&amp;gt; element.value);  &amp;#x2F;&amp;#x2F; [{ value: &amp;#x27;a&amp;#x27; }, { value: &amp;#x27;b&amp;#x27; }]
&lt;/code&gt;&lt;/pre&gt;
You have to write a little bit more (I could have used &amp;quot;e&amp;quot; instead of &amp;quot;element&amp;quot;, though) but if you do a typo in the name of the property, it can be caught by a linter&amp;#x2F;compiler, and you don&amp;#x27;t get the feeling you&amp;#x27;re relying on Vodoo magic.&lt;p&gt;Are there any advantages to use a string instead of a &amp;quot;static&amp;quot; way of accessing the property ?</text></item></parent_chain><comment><author>topaxi</author><text>The xxBy methods are just for convenience, usually you can provide your own function for each method.&lt;p&gt;Example:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    Ember.computed.map(&amp;#x27;myArray&amp;#x27;, function() {
      return foo.bar;
    })
&lt;/code&gt;&lt;/pre&gt;
vs.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    Ember.computed.mapBy(&amp;#x27;myArray&amp;#x27;, &amp;#x27;bar&amp;#x27;)
&lt;/code&gt;&lt;/pre&gt;
What you are asking for, would need a change to Ember.computed.uniq, allowing it to accept a custom function.</text></comment>