0.5.0 • Published 4 years ago

@pansy/group-by v0.5.0

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

根据迭代函数返回的值对数组进行分组。

📦 安装

// npm
npm install @pansy/group-by --save

// yarn
yarn add @pansy/group-by

🔨 使用

import groupBy from '@pansy/group-by';

const list = [
  { module: 'module1', action: 'action1' },
  { module: 'module1', action: 'action2' },
  { module: 'module2', action: 'action1' }
];

console.log(groupBy(list, item => item.module));

// => {
// =>   module1: [
// =>     { module: 'module1', action: 'action1' },
// =>     { module: 'module1', action: 'action2' },
// =>   ],
// =>   module2: [
// =>     { module: 'module2', action: 'action1' }
// =>   ]
// => }
0.5.0

4 years ago

0.4.0

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.4

4 years ago