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

No way to return function as a value #83

Open
brianjmiller opened this issue Jul 5, 2018 · 3 comments
Open

No way to return function as a value #83

brianjmiller opened this issue Jul 5, 2018 · 3 comments
Assignees
Milestone

Comments

@brianjmiller
Copy link

Was finally looking to upgrade dependencies in an existing project from 0.9.6 (I know, I'm sorry) to latest, and it seems there is no way to return a function as a value. We were using the ability to look up into a deep object structure knowing that the leaf might be a function, but we need the ability to pass arguments to the invocation of that function. Would this ever be considered as an option or should we look at an alternative module? Have I just missed something obvious in the 1.x interface?

@wilmoore
Copy link
Owner

We were using the ability to look up into a deep object structure knowing that the leaf might be a function

The current functionality; while "cute" is not so helpful for your particular use-case; thought it did fit my use-case perfectly at the time I implemented it.

... but we need the ability to pass arguments to the invocation of that function.

Bad news:
This is currently impossible as implemented.

Good news:
I'm going to drop the automatic function invocation in v2.

If you want this now, you might consider:
https://lodash.com/docs#invoke

Would this ever be considered as an option or should we look at an alternative module? Have I just missed something obvious in the 1.x interface?

See ☝️

@wilmoore wilmoore self-assigned this Jul 23, 2018
@wilmoore wilmoore added this to the 2.0.0 milestone Jul 23, 2018
@brianjmiller
Copy link
Author

Thanks for the reply, no worries. We've since switched to Hoek.reach we were already using Joi anyways, and it works for our simple use case. Thanks for selectn I'll keep it mind for the future.

@maranac0d3r
Copy link

@brianjmiller Please check this Repo for returning functions as not executed one.

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

3 participants