showing results for - "import lodash"
Iban
20 Sep 2017
1// import entire library
2import _ from "lodash"
3const nums = [1, 2, 2, 3, 1, 4]
4let res = _.uniq(nums)
5
6// import methods by name
7// Still loads entire lodash library!!
8import { uniq } from "lodash"
9const nums = [1, 2, 2, 3, 1, 4]
10let res = uniq(nums) // better readability
11
12// import only what you need
13import uniq from "loadash/uniq"
14const nums = [1, 2, 2, 3, 1, 4]
15let res = uniq(nums)
16