antfu / utils

Collection of common JavaScript / TypeScript utils
MIT License
791 stars 60 forks source link

feat(array): `isDeepEqual` and `uniqueBy` #24

Closed akinoccc closed 1 year ago

akinoccc commented 2 years ago

Description

add the method unique muti-type array.

example: [{ a: 1 }, { a: 1 }, 1, 2, 1, [1, 2], [1, 2]] => [{ a: 1 }, 1, 2, [1, 2]]

antfu commented 2 years ago

I think we could extract the isEqual to a standalone utility isDeepEqual, and another uniqueBy(array, equalFn) to be able to compose to your goal

akinoccc commented 2 years ago

I think we could extract the isEqual to a standalone utility isDeepEqual, and another uniqueBy(array, equalFn) to be able to compose to your goal

haha, I think so. I'll revise it later

akinoccc commented 2 years ago

I think we could extract the isEqual to a standalone utility isDeepEqual, and another uniqueBy(array, equalFn) to be able to compose to your goal

I done it.