use
use copied to clipboard
Consider few features?
- [x] allow passing custom
plugins
property, currently is just.fns
- maybeopts.prop
- [x] allow accept options to each plugin, like
.use(plugin, options)
- [x] from above needs next: allow passing function to transform/extend/merge
app.options
and options that comes from each plugin - something likeopts.fn.call(self, self, options)
in the.use
method - [ ] allow passing custom arguments to plugin function, currently is only
app
- maybe something likeopts.params
make sense - [ ] allow passing not only object to
.run
#2, but any kind and any number of arguments
You can see all this with tests in https://github.com/tunnckoCore/use-ware :)
Let me know if you want some PRs. It would be great to merge, because I like this nesting that this package allows.
Okay, I like these ideas, it would make .use
more consistent with plugin handling in base
.
How about if we split this into two issues?
- bullets 1-3 (let's start with this one before we do anything else, so we can evaluate these separately)
- The rest
Sound good?
Great! I'll send a PR for the first 3 bullets.
So, first three are ready with #4 merging. What about the others? :)
I don't see value on forcing .run
to accept only object as first argument, and only one argument.
Would you mind doing a pr so we can review?
Okey, that's what I wanted to hear, like it. :D I'll try.
@jonschlinkert can we process with the last 2 bullets tonight/today? I have some time. :) I'm not sure for the last one should be implemented and how to save current behaving and decorating.
edit: about the 4th this commit to use-ware
may help you to understand it better
yeah that seems reasonable. @doowb?
Yeah, I'd like to see a PR for discussion.
I'm not sure for the last one should be implemented and how to save current behaving and decorating.
I think you can pass the opts
into the base
function inside decorate
and the rest of the functionality will be the same. We can try it out.
Mmm. Problem is on #L73: if (!utils.isObject(val)) return;
for me. And actually the whole .run
, because the idea is to be able to pass different number of argument of different type. So we can just do val.use()
trick and the decorating.