Skip to content

Commit

Permalink
perf(array): shorten the code (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
hero-guo authored Feb 25, 2020
1 parent bf6128e commit f870676
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/shared/src/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ type MemoObjectIterator<TValue, TResult> = (
key: string
) => TResult

export const toArr = (val: any): any[] => (isArr(val) ? val : val ? [val] : [])

export const toArr = (val: any): any[] => [].concat(val || [])
export function each(
val: string,
iterator: EachStringIterator,
Expand Down

0 comments on commit f870676

Please sign in to comment.