dot-wild
dot-wild copied to clipboard
Get value returned from function [deeply]
This package is awesome. I was actually writting something exactly like this. With a few exceptional rules tho. The difference was on the wildcard *. mine doesn't require that. but seeing this is already fully featured. Let's expand on that.
Key panther does something nice, take a look at this:
var getKeypath = require('keypather/get');
var obj = {
foo: function () {
return function () {
return function () {
return 'val';
};
};
}
};
getKeypath(obj, "foo()()()"); // val
This should be easy to implement. Just call the function at the path end and return its value. Do that deeply as much as it takes.