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

Get value returned from function [deeply] #15

Open
emahuni opened this issue Aug 16, 2018 · 0 comments
Open

Get value returned from function [deeply] #15

emahuni opened this issue Aug 16, 2018 · 0 comments

Comments

@emahuni
Copy link

emahuni commented Aug 16, 2018

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.

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

1 participant