mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 18:01:24 +08:00
6503e55277
* refactor(utils-v2): migrate utils * refactor(utils-v2): migrate utils * refactor(utils-v2): migrate utils * refactor(utils): remove * refactor(utils): rename * refactor(utils): move EVENT_CODE to constants * refactor: remove generic
8 lines
252 B
TypeScript
8 lines
252 B
TypeScript
export const unique = <T>(arr: T[]) => [...new Set(arr)]
|
|
|
|
/** like `_.castArray`, except falsy value returns empty array. */
|
|
export const castArray = (arr: any): any[] => {
|
|
if (!arr && arr !== 0) return []
|
|
return Array.isArray(arr) ? arr : [arr]
|
|
}
|