Array.includes()
function test(fruit) {
const redFruits = ['apple', 'strawberry', 'cherry', 'cranberries'];
if (redFruits.includes(fruit)) {
console.log('red');
}
}
Promise.all
await Promise.all(map(names, async name => {
const record = JSON.parse(await queryInterface.rawSelect(
'public_configs',
{
where: {
name,
},
},
[ 'config_detail' ]
));
const columnSettings = get(record, 'tableConfig.columnSettings') || [];
const targetIndex = findIndex(columnSettings, { columnType: 'entityType' }) + 1;
columnSettings.splice(targetIndex, 0, addItem);
await queryInterface.bulkUpdate('public_configs', {
name,
config_detail: JSON.stringify(record),
}, {
name,
});
}));