omitUndefined 函数用于从对象中排除值为 undefined 的键。
import { omitUndefined } from '@movk/core'
const data = {
name: 'John',
age: undefined,
city: 'New York',
country: undefined
}
const cleaned = omitUndefined(data)
console.log(cleaned) // { name: 'John', city: 'New York' }
// 用于 API 请求前清理数据
const requestData = omitUndefined({
title: 'Post Title',
content: 'Post content',
tags: undefined,
published: true
})
omitUndefined(obj)从对象中排除值为 undefined 的键。
undefined 值后的新对象。b6146 — refactor: 统一源码文件命名为 camelCase