mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 09:20:51 +08:00
e083447b48
* refactor(components): [collapse] refactor * refactor(components): [collapse] refactor * refactor: rename Co-authored-by: 三咲智子 <sxzz@sxzz.moe>
13 lines
399 B
TypeScript
13 lines
399 B
TypeScript
export const unique = <T>(arr: T[]) => [...new Set(arr)]
|
|
|
|
// TODO: rename to `ensureArray`
|
|
/** 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]
|
|
}
|
|
|
|
// TODO: remove import alias
|
|
// avoid naming conflicts
|
|
export { castArray as ensureArray } from 'lodash-unified'
|