Skip to content
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

Possible to have stopPaths not be relative to the data root? #65

Open
danielcrk opened this issue May 18, 2020 · 3 comments
Open

Possible to have stopPaths not be relative to the data root? #65

danielcrk opened this issue May 18, 2020 · 3 comments

Comments

@danielcrk
Copy link

danielcrk commented May 18, 2020

I love the stopPaths feature, however, in a structure that looks something like this:

{
  "foo": [
    {
      "bar": {
        "baz": {...}
      }
    }
  ] 
}

... where I want baz to remain uncamelized, it's kinda unusable, as far as I understand.

Would it be possible to do something like stopPaths: ['*.bar.baz']? Does that make sense?

@sindresorhus
Copy link
Owner

I'm open to supporting this use-case, but the syntax has to be well thought through.

I still think the path should be absolute. Just matching from the end feels a bit loose.

How about something like '*.[].bar.baz', where * means any property and [] means it's an array?

@aspirisen
Copy link

I have faced the same issue, do you know what is current approach with arrays for stopPath?

@SafNaaz
Copy link

SafNaaz commented Sep 16, 2022

@aspirisen currently arrayname.property works. no need of []

eg, I wanted to stop elements under 'c' getting conveted in a: [ { b : 'x' , c : { d : 'e' } } ]

for that stopPaths:['a.c'] worked.

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

No branches or pull requests

4 participants