summaryrefslogtreecommitdiffstats
path: root/public/src/app/api/temp.ts
blob: 9601374bbbd732257cb3182c6a7b3b148a03ef3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// import { chain, groupBy } from 'lodash';
import { groupBy, prop, compose, values } from 'ramda';

const arr = [
  {
    groupId: 'map0',
    groupName: 'rony'
  },
  {
    groupId: 'enrich0',
    groupName: 'stone'
  },
  {
    groupId: 'map0',
    groupName: 'vosk'
  },
  {
    groupId: 'enrich1',
    groupName: 'liav'
  }
];

const fn = compose(values, groupBy(prop('groupId')))(arr);
const dis = fn.map(item => {
  return { groupId: item[0].groupId, rulesList: item };
});
console.log(fn);
console.log(dis);
// console.log(groupBy(prop('groupId'))(arr));