Skip to content

Instantly share code, notes, and snippets.

@fuji44
Last active October 9, 2021 07:08
Show Gist options
  • Save fuji44/d9ae4d6a1247d31ef552745ee9b19855 to your computer and use it in GitHub Desktop.
Save fuji44/d9ae4d6a1247d31ef552745ee9b19855 to your computer and use it in GitHub Desktop.
指定された配列を元に、重複を排除した配列を返します。
const unique = <T>(targets: Array<T[]>): T[] => {
return [
...new Set(
targets.reduce((result, current) => {
return result.concat(current)
}, [])
),
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment