New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ysfe/array-groupby

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ysfe/array-groupby

array group by function. support Array.prototype

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
4
Created
Source

数组分组函数(array group by)

install

  • yarn add @ysfe/array-groupby or npm install @ysfe/array-groupby --save

use

// import for commonJs
import { GroupBy, addToProperty } from "array-grouping";

// use
GroupBy([your array],(a:T,b:T):boolean => { return a == b; // diff func. })

// 挂载到原型链 - 使用方法参考 array.sort()

addToProperty() // 添加到原型

[].groupBy((a,b)=> {
  return a.id == b.id
})

use demo (详细使用例子参考 )[link:https://github.com/a951055/array-grouping/blob/master/src/index.test.ts]

1. use GroupBy demo.

 import { GroupBy } from "array-grouping";

// example - 1 - grouping array

let arr1 = new Array<number>(20).fill(0).map(n => Math.ceil(Math.random() * 100));
// exec
let result = GroupBy(arr1, (a, b) => a == b);
// print
console.log(result);

Keywords

array

FAQs

Package last updated on 24 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts