-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapValues bug? throw a TypeError: callback must be a function #1233
Comments
The difference is You will need to change your code to something like async.mapValues({
'a': 'here/log/TEST/123.txt',
'b': 'here/log/TEST/133.txt' },
(value, key, callback) => fs.stat(value, callback),
function(err, result) {
console.log('statses=', result);
}
); |
Thanks, it works great! |
Ohhhh, want to submit a PR fixing that sample code? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of async are you using?
2.0.0-rc.6
Which environment did the issue occur in (Node version/browser version)
4.2.6
What did you do? Please include a minimal reproducable case illustrating issue.
call mapValues as the example:
async.mapValues({
'a': 'here/log/TEST/123.txt',
'b': 'here/log/TEST/133.txt' },
fs.stat,
function(err, result) {
console.log('statses=', result);
});
What did you expect to happen?
{'a': stat for file a,
'b' : stat for file b }
What was the actual result?
TypeError: callback must be a function
at makeCallback (fs.js:78:11)
at fs.stat (fs.js:826:14)
at /volume1/web/mywebapp/node_modules/async/dist/async.js:5098:13
at replenish (/volume1/web/mywebapp/node_modules/async/dist/async.js:871:21)
at /volume1/web/mywebapp/node_modules/async/dist/async.js:881:15
at eachOfLimit (/volume1/web/mywebapp/node_modules/async/dist/async.js:3952:26)
at mapValuesLimit (/volume1/web/mywebapp/node_modules/async/dist/async.js:5097:9)
at Object.mapValues (/volume1/web/mywebapp/node_modules/async/dist/async.js:930:20)
at /volume1/web/mywebapp/logmanager.js:45:10
at nextTask (/volume1/web/mywebapp/node_modules/async/dist/async.js:6627:18)
BTW, I use async.map , it works good:
async.map([
'here/log/TEST/123.txt',
'here/log/TEST/133.txt' ],
fs.stat,
function(err, result) {
console.log('statses=', result);
});
The text was updated successfully, but these errors were encountered: