Wanted real path with dot-notation in JSONSelect.forEach callback #35

Open
ghost opened this Issue Feb 24, 2012 · 1 comment

Projects

None yet

1 participant

@ghost
ghost commented Feb 24, 2012

Hello there!
First of all, your project is awesome!

It would be great if you could add the real-path with dot-notation of matched values in place of second argument of callback in forEach-method.

For example, we have a JSON:

var data = {
a: {x: 1, y: 2},
b: ["one", "two"]
};

JSONSelect.forEach('.a > number, .b :nth-child(1n)', data, function( value, path ){
// Here I would love to see:
// value - 1, path - "a.x"
// value - 2, path - "a.y"
// value - "one", path - "b.0"
// value - "two", path - "b.1"
});

Is it possible?
Thank you in advance.

studgeek commented Apr 6, 2012

I would like to see something similar in expr. So you could do something like ".a:expr(x.y = 2)" (note that x in this case is actually the variable for expr which will actually be a :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment