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
"use strict"; | |
const Q = require('q'); | |
const fn = require('fn.js'); | |
// Maps a function that returns a promise and then passes that array of promises to Q.all so they are all processed | |
const mapAll = fn.curry(fn.compose(Q.all, fn.map), 2); | |
// Returns a promise | |
function returnPromise(something) { | |
return Q().then(() => something); |
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
const Q = require('q'); | |
/** | |
* Transforms a Promise to a Q promise | |
* @param {Promise} promise | |
* @return {Q} | |
*/ | |
function pq(promise) { | |
const deferred = Q.defer(); |
NewerOlder