Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce number of components searched (#149)
This commit has 2 goals: 1) A small refactoring of the getValue method to split out the multiple/single value cases. 2) Decrease the number of elements `_getValue` searches through if possible. `Array.prototype.find` stops iterating on the array when the callback returns truthy. `options` is an `Ember.A` which means it should polyfill the `Array.prototype.find` method. Say you have an array like: ```javascript const values = [1, 2, 3]; ``` If we're looking for the value `2`, we only want to search the array two times, because the number 2 is found on the second iteration. This reduces the amount of work we have to do on larger arrays because we can bail if the element is found early. While this doesn't matter much on an array of 5, it can matter more with bigger arrays especially since we're querying the DOM.
- Loading branch information