| 50 | |
| 51 | // :: a -> [b] |
| 52 | export const uniqBy = x => y => { |
| 53 | const checked = new Set(); |
| 54 | const result = []; |
| 55 | |
| 56 | y.forEach(a => { |
| 57 | const prop = a[x]; |
| 58 | if (!checked.has(prop)) { |
| 59 | checked.add(prop); |
| 60 | result.push(a); |
| 61 | } |
| 62 | }); |
| 63 | |
| 64 | return result; |
| 65 | }; |
| 66 | |
| 67 | /** |
| 68 | * :: [a] -> [a] -> boolean |