Skip to content

Instantly share code, notes, and snippets.

@ppraksa
Created March 24, 2017 15:44
Show Gist options
  • Save ppraksa/73ede75ef170a4ffa8ad8a94853a912c to your computer and use it in GitHub Desktop.
Save ppraksa/73ede75ef170a4ffa8ad8a94853a912c to your computer and use it in GitHub Desktop.
Simple test wit cb
function test(...args) {
try {
var cb = args.pop();
(cb.constructor.name === 'Function') ? null : new Error('isnt fn');
let a = args,
tmp = 0,
it = a[Symbol.iterator]();
do {
tmp = it.next();
if(tmp.value != undefined) {
console.log(`Value is: ${tmp.value}`);
!isNaN(tmp.value) ? null : new Error('isnt int');
}
} while(!tmp.done)
console.log(cb);
}
catch(e) {
console.log(e);
}
return {
cb, args
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment