📜  javascript 对象过滤器 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:36.584000             🧑  作者: Mango

代码示例6
const raw = {
  item1: { key: 'sdfd', value:'sdfd' },
  item2: { key: 'sdfd', value:'sdfd' },
  item3: { key: 'sdfd', value:'sdfd' }
};

const allowed = ['item1', 'item3'];

const object = Object.fromEntries(
    Object.entries(tt).filter(([key, value]) => currentInputs.includes(key))
);