Last active
October 2, 2015 13:00
-
-
Save mathieuancelin/617330b48108bfbfb690 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Types = Object.freeze({ | |
Unit: Symbol('Unit') | |
}); | |
function uselessPromise() { | |
return new Promise(resolve => { | |
console.log('Doing stuff !!!'); | |
setTimeout(() => resolve(Types.Unit), 200) | |
}).then(res => { | |
if (res === Types.Unit && | |
res !== 'unit' && | |
res !== Symbol('unit')) { | |
return 'Success !!!'; | |
} else { | |
return 'Failure :('; | |
} | |
}); | |
} | |
uselessPromise() | |
.then(res => console.log('Result is : ', res)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment