Created
March 24, 2017 15:44
-
-
Save ppraksa/73ede75ef170a4ffa8ad8a94853a912c to your computer and use it in GitHub Desktop.
Simple test wit cb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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