Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Change interface of .act() callback functions #39

arikon opened this Issue Jul 19, 2013 · 3 comments


None yet
3 participants

arikon commented Jul 19, 2013

My proposal it to change API of .act() callbacks from

function(opts, args) {


function(options) {
   // options = opts + args


  1. The difference between opts and args in semantical only and only make sense when command is run from the command line

  2. It is hard to explain to develepor what the difference between opts and args when it uses COA API to run command

  3. Division into two different arguments makes sense in case when opts is a hash and args is an array

  4. Compare

    var BEM = require('bem');
    BEM.api.create.block({ tech: ['css', 'js'] }, { names: ['b1', 'b2'] });


    var BEM = require('bem');
    BEM.api.create.block({ names: ['b1', 'b2'], tech: ['css', 'js'] });

/cc @veged


veged commented Jul 19, 2013

we can just add args to opts but keep second argument for act function for full backward compatibility


arikon commented Jul 19, 2013

@veged Backwards compatibility will broke if there were args and opts with the same name('...') declaration


veged commented Jul 20, 2013

@arikon yep, but that's some kind "unsemantic" and seems nobody do that

@zxqfox zxqfox added the enhancement label May 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment