question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

array.findBy returning an array?

See original GitHub issue

I’ve tested it and I can’t seem to get array.findBy to return the true value that is being returned from Ember.Array.findBy

...
myArray: computed(..., function() {
  return [{
         "name": "Object 1",
         "isActive": true
   },{
         "name": "Object 2",
         "isActive": false
   },{
         "name": "Object 3",
         "isActive": false
   }];
}),
activeRow: array.findBy('myArray','isActive',true) // returns [ {...}, {...}, {...} ]
...

Meanwhile…

myObject.get('myArray').findBy('isActive') // returns {...}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mriskacommented, Oct 19, 2018

@jfrux, no problem. I have made the same mistake myself and so have several of my colleagues. You are in good and plentiful company here 😃

0reactions
kellyseldencommented, Oct 19, 2018

Thanks @mriska!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return array with Doctrine findBy method - Stack Overflow
I am using the Doctrine findBy() method, but I want to get arrays returned instead of objects. This is my query:
Read more >
Array.prototype.find() - JavaScript - MDN Web Docs - Mozilla
A function to execute for each element in the array. It should return a truthy value to indicate a matching element has been...
Read more >
Query an Array — MongoDB Manual
To query if the array field contains at least one element with the specified value, use the filter { <field>: <value> } where...
Read more >
About Queries | Testing Library
findAllBy... : Returns a promise which resolves to an array of elements when any elements are found which match the given query.
Read more >
JavaScript Array find() Method - GeeksforGeeks
Syntax: · Parameters: This method accepts 5 parameters as mentioned above and described below: · Return value: It returns the array element value ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found