Вместо:
.then(sender => {
sendersArray.push(sender);
})
Попробуйте:
.then(sender => {
sendersArray.push(sender);
if (sendersArray.length == transactions.length)
res.send(sendersArray);
})
и удалите res.send(sendersArray);
в конце.
Promise.all
должно работать примерно так:
.then(transactions =>
Promise.all(
transactions.map(({ id_recipient }) => { return new Promise( (resolve, reject) => {
User.findAll({
where: {
id: id_recipient,
},
attributes: ['name', 'surname'],
include: [
{
model: Transaction,
where: { id_sender: db.Sequelize.col('user.id') },
attributes: [
'amount_money',
'date_time',
'transfer_title',
'id_recipient',
'id_sender',
],
},
],
})
.then(sender => {
resolve(JSON.stringify(sender)); // <- this is string, i need this to send res
})
.catch(err => {
reject(err);
}),
})}),
),
)
.then((results) => {
res.send(results);
});
Просто удостоверьтесь, что определение mkdListItem после определения mkdCodeBlock, как это:
syn match mkdCodeBlock /\(\s\{4,}\|\t\{1,}\).*\n/ contained nextgroup=mkdCodeBlock
hi link mkdCodeBlock comment
syn region mkdListItem start=/\s*[-*+]\s\+/ matchgroup=pdcListText end=".*" contained nextgroup=mkdListItem,mkdListSkipNL contains=@Spell skipnl
syn match mkdListSkipNL /\s*\n/ contained nextgroup=mkdListItem,mkdListSkipNL skipnl
hi link mkdListItem operator
syn match mkdBlankLine /^\s*\n/ nextgroup=mkdCodeBlock,mkdListItem transparent
В документации Vim говорится в :help :syn-define
:
"В случае, если больше чем один объект соответствует в том же положении, то, которое было определено ПОСЛЕДНИЕ победы. Таким образом можно переопределить ранее определенные объекты синтаксиса при помощи объекта, который соответствует тому же тексту. Но ключевое слово всегда идет перед соответствием или регионом. И ключевое слово с соответствием случаю всегда идет перед ключевым словом с игнорированием регистра".
hcs42 был корректен. Я действительно не забываю читать тот раздел теперь, но я забыл об этом, пока hcs24 не напомнил мне об этом.
Вот мой обновленный синтаксис (немного других тонких настроек), который работает:
""""""""""""""""""""""""""""""""""""""" " Code Blocks: " Indent with at least 4 space or 1 tab " This rule must appear for mkdListItem, or highlighting gets messed up syn match mkdCodeBlock /\(\s\{4,}\|\t\{1,}\).*\n/ contained nextgroup=mkdCodeBlock """"""""""""""""""""""""""""""""""""""" " Lists: " These first two rules need to be first or the highlighting will be " incorrect " Continue a list on the current line or next line syn match mkdListCont /\s*[^-+*].*/ contained nextgroup=mkdListCont,mkdListItem,mkdListSkipNL contains=@Spell skipnl transparent " Skip empty lines syn match mkdListSkipNL /\s*\n/ contained nextgroup=mkdListItem,mkdListSkipNL " Unorder list syn match mkdListItem /\s*[-*+]\s\+/ contained nextgroup=mkdListSkipNL,mkdListCont skipnl