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

API usage improvements #22

Closed
daffl opened this issue Feb 12, 2020 · 1 comment · Fixed by #32
Closed

API usage improvements #22

daffl opened this issue Feb 12, 2020 · 1 comment · Fixed by #32

Comments

@daffl
Copy link
Member

daffl commented Feb 12, 2020

The current API still feels a little verbose. I'd really like to offer something that is chainable, offering all the current functionality but a little more concise:

const sayHi = hooks(name => `Hi ${name}`, [ hook1 ]).params('name').defaults({
  name: 'Dave'
});

This would still work on objects:

const o = {
  sayHi(name) { return `Hi ${name}` }
}

hooks(o, {
  sayHi: hooks([ hook1 ]).params('name').defaults({
    name: 'Dave'
  })
});
@bertho-zero
Copy link
Collaborator

#23

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 a pull request may close this issue.

2 participants