victorquinn/dynasty

.list() optional parameters

Closed this issue · 3 comments

It appears that the code doesn't support the optional parameter as 'optional' when using a callback...

Need to shift the callback function given to the callback variable in the method if no parameter is given.

In JS I usually use something like:

//Handle options arguments
if( _.isUndefined(cb) )
if( _.isFunction(param) )
( param = options ) && ( param = undefined );

Not sure what you would do with that in CoffeeScript.

To reproduce:

var tableList = dynamo.list(function( err, test){

console.log('test');

});

and you will see the callback is never called.

Actually, after looking at the code, the issue is:

if (params == !null) {

needs to be more like:

if (params !== null) {

and probably:

if ( ! _.isNil(params) ){

filed issue #79 to resolve

Looks like this was fixed with #79 closing