perfectacle / async-to-sync

async-to-sync is help you for Javascript asynchronous function to synchronous function.
MIT License
5 stars 0 forks source link

TypeError: ats is not a function #1

Open MrNocTV opened 5 years ago

MrNocTV commented 5 years ago

I got this issue the first time I tried,

here is the import

require('babel-polyfill');
const ats = require('async-to-sync/module/no-es2017');

here is the code that use ats:

var fallback = function(e) {
    alert('Error: ' + e);
  };

var requests = categories.map(function(subcat) {
    getItemLinksOfCat(url, subcat)
});

var arrAsync = [requestsm, fallback]
ats(arrAsync);

console.log("next code")

and here is the message:

TypeError: ats is not a function
    at Object.<anonymous> (/Users/loctv/solution.js:164:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
NullVoxPopuli commented 2 years ago

use ats.default