a.replace(/\n\n\n/g, '\n\n').replace(/پرشین/g, 'فارسی').split('\n\n').map(x => ['MediaWiki:' + x.split('\n')[1].split('"')[1] + '/fa', x.split('\n')[3].split('"')[1]]).filter(x => x[1].length)
.map(x => () => { console.log(x); return new Promise(resolve => { new mw.Api().post({ action: 'edit', createonly: '', title: x[0], text: x[1], token: mw.user.tokens.get('editToken') }).then(resolve, resolve); }); })
.reduce((promise, next) => promise.then(next), Promise.resolve())
.then(() => console.log('Async Job Queue done'));