Created
February 2, 2016 03:37
-
-
Save brianchung808/8daa1fca132b54ec0beb 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
| import most from 'most'; | |
| const fromNodeCallback = (nodeCallback) => { | |
| return (...args) => { | |
| return most.create((add, end, error) => { | |
| return nodeCallback(...args, function cb(err, ...data) { | |
| // if data has more than one element, leave as array. Else, pass along that single value | |
| err ? error(err) : data.length > 1 ? add(data) : add(...data); | |
| end(); | |
| }); | |
| }); | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment