coa
coa copied to clipboard
Change interface of .act() callback functions
My proposal it to change API of .act()
callbacks from
function(opts, args) {
}
to
function(options) {
// options = opts + args
}
Motivation
-
The difference between
opts
andargs
in semantical only and only make sense when command is run from the command line -
It is hard to explain to develepor what the difference between
opts
andargs
when it uses COA API to run command -
Division into two different arguments makes sense in case when
opts
is a hash andargs
is an array -
Compare
var BEM = require('bem'); BEM.api.create.block({ tech: ['css', 'js'] }, { names: ['b1', 'b2'] });
and
var BEM = require('bem'); BEM.api.create.block({ names: ['b1', 'b2'], tech: ['css', 'js'] });
/cc @veged
we can just add args
to opts
but keep second argument for act
function for full backward compatibility
@veged Backwards compatibility will broke if there were args and opts with the same name('...')
declaration
@arikon yep, but that's some kind "unsemantic" and seems nobody do that