Closed yocontra closed 10 years ago
The reasoning behind was so you didn't have to change your existing Gulp code.
For example, previously if you had:
var jshint = require("gulp-jshint");
// setup Gulp task that calls `jshint`()
And then you swapped to using this plugin and passing in this
, you wouldn't have to change your Gulp plugin configuration. If you extend another object, such as tasks
, you'd have to change your code to use tasks.jshint()
.
That was the reasoning - I think it would be nice to make it return an object if no argument is passed, as per your example.
@jackfranklin Makes sense
@Contra turns out that adding things to this
isn't really a good idea - doesn't always work. Hence, am going to update the plugin to take your suggestion into account and do it that way.
Why do
When instead you could do this
It seems more idiomatic to return a new object with all of the tasks on it than to extend them onto an object passed in as an argument.