Skip to content

Instantly share code, notes, and snippets.

@brianchung808
Created February 2, 2016 03:37
Show Gist options
  • Select an option

  • Save brianchung808/8daa1fca132b54ec0beb to your computer and use it in GitHub Desktop.

Select an option

Save brianchung808/8daa1fca132b54ec0beb to your computer and use it in GitHub Desktop.
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