Array.includes()

function test(fruit) { // extract conditions to array const redFruits = ['apple', 'strawberry', 'cherry', 'cranberries']; if (redFruits.includes(fruit)) { console.log('red'); }}Copy the code

Promise.all

await Promise.all(map(names, async name => { const record = JSON.parse(await queryInterface.rawSelect( 'public_configs', { where: { name, }, }, [ 'config_detail' ] )); / / <! - add 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, }); }));Copy the code