alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
317 stars 97 forks source link

Don't clobber bop()'s first parameter. #40

Closed vin closed 12 years ago

vin commented 12 years ago

Now a call like

bot.bop(callback);

is the same as

bot.vote('up', callback);

Before this change, the caller had to pass in a dummy first argument like

bot.bop(null, callback);
alaingilbert commented 12 years ago
> var arguments = [1, 2, 3];
undefined
> arguments
[ 1, 2, 3 ]
> var args = Array.prototype.slice(arguments);
undefined
> args
[]
> args.unshift('up')
1
> args
[ 'up' ]
> var a = function () {
      var args = Array.prototype.slice(arguments);
      args.unshift('up');
      console.log(args);
    };
undefined
> a(1, 2);
[ 'up' ]

It doesn't seems to work.

alaingilbert commented 12 years ago

I changed this line:

var args = Array.prototype.slice(arguments);

by:

var args = Array.prototype.slice.call(arguments);
vin commented 12 years ago

Woops, thanks. Next time I'll test it first :-X