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

feat: Refactoring to pass an option object to initialize hooks more explicitly #7

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

daffl
Copy link
Member

@daffl daffl commented Jan 11, 2020

Changes the API from hooks(fn, [ hook1, hook2 ], withParams('name')) to

hooks(fn, {
  middleware: [ hook1, hook2 ],
  context: withParams('name'))
});

Which is more explicit, allows for future options and makes object and class initialization easier.

Also adds a collect option which usually probably will not be used but is useful if you want to customize where middleware comes from for a function call.

@daffl daffl merged commit 8f2453f into master Jan 13, 2020
@daffl daffl deleted the hook-options branch January 13, 2020 20:22
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

Successfully merging this pull request may close these issues.

None yet

1 participant