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

Feature request: queryGet.ASSOCIATIVE #1

Closed
benurb opened this issue Dec 29, 2016 · 3 comments
Closed

Feature request: queryGet.ASSOCIATIVE #1

benurb opened this issue Dec 29, 2016 · 3 comments

Comments

@benurb
Copy link
Contributor

benurb commented Dec 29, 2016

Hi @sagold 😄

Maybe you also think it might be a good idea to have a shortcut for the following use case:

const result = {};
jsonQuery.run(this._data, pointer, (value, key, object, dataPointer) => {
    result[dataPointer] = value;
});
// result then is something like: { pointer1: data1, pointer2: data2, ... }

The shortcut would be:

const result = jsonQuery.get(this._data, pointer, jsonQuery.get.ASSOCIATIVE);

What do you think?

Ben

@benurb benurb changed the title Feature: queryGet.ASSOCIATIVE Feature request: queryGet.ASSOCIATIVE Dec 29, 2016
@sagold
Copy link
Owner

sagold commented Dec 29, 2016

Hi @benurb.

Yes. I Think this is a good idea. Spontaneously i would have implemented it as a separate method like in jsonpointer.dict. Using the same name or something like explode :). This stands against the interface of this repository, but it would be much simpler to use. What do you think?

@benurb
Copy link
Contributor Author

benurb commented Dec 30, 2016

Sounds good. I'll create a PR. I would not use dict(), because in json-pointer it doesn't use a pointer to create the dictionary. But in this use case here there is a pointer.

@benurb benurb mentioned this issue Dec 30, 2016
@benurb
Copy link
Contributor Author

benurb commented Jan 1, 2017

Thank you!

@benurb benurb closed this as completed Jan 1, 2017
sagold pushed a commit that referenced this issue Oct 25, 2020
Fix Prototype Pollution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants