You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.
Hello, I'm newbie in Comb and I have the following problem with PromiseLists. I follow the documentation for PromiseLists and create following code:
var comb = require('comb');
fs = require('fs');
function readFiles(){
var files = comb.argsToArray(arguments).map(function(file){
return fs.readFile(file);
});
return new comb.PromiseList(files, true).promise();
}
readFiles("1.txt", "2.txt", "3.txt").then(function(files){
files.forEach(function(data){
console.log(data);
});
}, errorHandler);
When I run it, I got error:
/opt/dbtest/test2/node_modules/comb/lib/promise.js:529
promise.then(
^
TypeError: Cannot read property 'then' of undefined
at wrapper.__addPromise (/opt/dbtest/test2/node_modules/comb/lib/promise.js:529:20)
at forEach (/opt/dbtest/test2/node_modules/comb/lib/base/array.js:191:18)
at wrapper.constructor (/opt/dbtest/test2/node_modules/comb/lib/promise.js:515:17)
at spreadArgs (/opt/dbtest/test2/node_modules/comb/lib/base/functions.js:30:17)
at new wrapper (/opt/dbtest/test2/node_modules/comb/lib/define.js:77:19)
at spreadArgs (/opt/dbtest/test2/node_modules/comb/lib/base/functions.js:30:17)
at wrapper.defineConstructor (/opt/dbtest/test2/node_modules/comb/lib/define.js:329:9)
at readFiles (/opt/dbtest/test2/app.js:10:9)
at Object.<anonymous> (/opt/dbtest/test2/app.js:14:1)
at Module._compile (module.js:570:32)
I'm running it on Node 6.10.2, the version of Comb is 1.0.1
Thanks,
Stoyan
The text was updated successfully, but these errors were encountered:
I think you need to turn fs.readFile into a comb Promise. The examples all build off of each so, you can find the readFile non-standard lib one in at the top of the Promises doc. Try swapping the fs version out for the one in the docs.
Also, we don't run comb on node 6 internally so you might run into some bugs. It looks like the tests pass though.
Hello, I'm newbie in Comb and I have the following problem with PromiseLists. I follow the documentation for PromiseLists and create following code:
When I run it, I got error:
I'm running it on Node 6.10.2, the version of Comb is 1.0.1
Thanks,
Stoyan
The text was updated successfully, but these errors were encountered: