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
| /** | |
| * Returns a Promise which resolves with a value in form of a tuple. | |
| * @param promiseFn A Promise to resolve as a tuple. | |
| * @returns Promise A Promise which resolves to a tuple of [error, ...results] | |
| */ | |
| export function tuple (promise) { | |
| return promise | |
| .then((...results) => [null, ...results]) | |
| .catch(error => [error]) | |
| } |