Skip to content

Commit 12fd5be

Browse files
Replace lodash.uniq() with Set
1 parent 20d5d76 commit 12fd5be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
integrity="sha256-O7FfDCaEf9kSRN9b9kmWu8C3rhL1hxEpPHp+CTZ4pMk=" crossorigin="anonymous" />
2626
<link rel="stylesheet" href="styles.css" />
2727

28-
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=Array.from,Map&flags=gated"></script>
28+
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=Array.from,Map,Set&flags=gated"></script>
2929
</head>
3030

3131
<body>

src/utils/trie.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { partition, uniq } from 'lodash';
1+
import { partition } from 'lodash';
22
import { Char, ICharTrie } from '../types/charTrie';
33

44
const leafNode = new Map() as ICharTrie;
@@ -56,6 +56,6 @@ function buildUnique(words: string[]): ICharTrie {
5656

5757
/** @borrows buildUnique as build */
5858
export function build(words: string[]): ICharTrie {
59-
const uniqueWords = uniq(words);
59+
const uniqueWords = [...new Set(words)];
6060
return buildUnique(uniqueWords);
6161
}

0 commit comments

Comments
 (0)