从对象中排除满足条件的键值对,返回不包含这些键的新对象
源对象的类型
源对象
判断函数,接收键和值,返回 true 则排除该键值对
true
不包含满足条件的键值对的新对象
const user = { id: 1, name: "Alice", age: 25, password: "secret"};// { name: "Alice", password: "secret" }const stringFields = omitBy(user, (key, value) => typeof value === "number"); Copy
const user = { id: 1, name: "Alice", age: 25, password: "secret"};// { name: "Alice", password: "secret" }const stringFields = omitBy(user, (key, value) => typeof value === "number");
从对象中排除满足条件的键值对,返回不包含这些键的新对象