Skip to content
New issue

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

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

Already on GitHub? # to your account

How to search across all data paths? #92

Open
FeltBoots opened this issue Mar 24, 2022 · 2 comments
Open

How to search across all data paths? #92

FeltBoots opened this issue Mar 24, 2022 · 2 comments

Comments

@FeltBoots
Copy link

Hi!

Let's say I have the following JSON data object inside struct view

foo: { bar: { items: [1, 2, 3, 4, 5] } }

Can I somehow force jora to search for 'items' key without manually typing foo.var.items?

I read documentation of jora https://github.com/discoveryjs/jora and could not found the solution. I might be missing something. It feels like there's some function or a way to do that but I can't get it.

@lahmatiy
Copy link
Member

lahmatiy commented Mar 24, 2022

There is no method for such problem, but you can use a query like this:

foo..values().['items' in keys()]

This will return an array of all objects with items field. You may use it as a helper:

$find: => ..values().[$$ in keys()];

foo.$find('items')

@FeltBoots
Copy link
Author

@lahmatiy, Thank you! Also it's a really nice idea to create helpers for specific needs in my project.

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

No branches or pull requests

2 participants