我愿意
if (program.url) {
checkJson = checkUrl(program.url, program.checks);
console.log('checkJson:', checkJson);
}
和
var checkUrl = function (url, checksfile) {
var checks = loadChecks(checksfile).sort();
rest.get(program.url).on('complete', function(data) {
var out = {};
$ = cheerioUrlData(data);
for (var ii in checks) {
var present = $(checks[ii]).length > 0;
out[checks[ii]] = present;
}
console.log(out); // <<-- This console
return out;
});
};
控制台看起来像
{ '.about': true,
'.blank': true,
'.faq': true,
'.footer': true,
'.heading': true,
'.logo': true,
'.navigation': true,
'.order': true,
'.pitch': true,
'.section1': true,
'.section2': true,
'.social': true,
'.subheading': true,
'.thermometer': true,
'.video': true,
h1: true }
但console.log('checkJson:', checkJson);
打印
checkJson: undefined
这里有什么不正确的?