array.groupBy in TypeScript

后端 未结 4 1498
囚心锁ツ
囚心锁ツ 2021-02-19 19:01

The basic array class has .map, .forEach, .filter, and .reduce, but .groupBy i noticably absent, preventing me f

4条回答
  •  长情又很酷
    2021-02-19 19:28

    A good option might be lodash.

    npm install --save lodash
    npm install --save-dev @types/lodash
    

    Just import it import * as _ from 'lodash' and use.

    Example

    _.groupBy(..)
    _.map(..)
    _.filter(..)
    

提交回复
热议问题