Skip to content

Add find by attribute and value #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: error-handling
Choose a base branch
from

Conversation

quangtam
Copy link

Add find object by attribute & value

Add find object by attribute & value
*/
findByAttr(type, attr, value) {
if (!this.graph[type]) return null;
var typeDatas = this.graph[type];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using Array.filter? Here you don't really retrieve all models matching attribute and value, only the first one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants