# groupx

> Group Data

Latest version **0.0.9** (published 2019-01-19) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install groupx
pnpm add groupx
yarn add groupx
bun add groupx
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2019-01-19 |
| First published | 2018-04-27 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 45.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jamal Abo Mokh |
| Maintainers | jamalabo1 |
| Keywords | group, group by, underscore group data, groupx |

## Links

- npm: https://www.npmjs.com/package/groupx
- Homepage: https://github.com/jamalabo1/groupx
- npm.io page: https://npm.io/package/groupx

## Dependencies (2)

- [moment](https://npm.io/package/moment.md) ^2.22.1
- [underscore](https://npm.io/package/underscore.md) ^1.9.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2019-01-19
- 0.0.8 — 2019-01-19
- 0.0.7 — 2018-07-19
- 0.0.6 — 2018-07-19
- 0.0.5 — 2018-07-19
- 0.0.4 — 2018-04-27
- 0.0.3 — 2018-04-27
- 0.0.2 — 2018-04-27
- 0.0.1 — 2018-04-27

## README

# Groupx

Group data using UnixTime in Javascript


## Install
`npm install --save groupx`

## Options

| Key |  Type | Default | Description
|--|--| -- | -- |
| Year | Integer |  Current Year  | Data of Year
| Month | Integer | Current Month | Data of month
| Search Key| String | create_time | Unix time key
| Sort | String | Month | Options: Week // Month // Year
| Format | Boolean | false | (if set to true) format week days to date  

## Functions



 - **month**: set group month.
 - **year**: set group year
 - **type**: sort type (by week/month/year)
 - **serach_key**: set search_key
 - **sort**: sort data
 - **format**: convert week days number to date, works **only** with arrays.



> You **can't** use month/year/type/search_key functions after **sort** and you can't use format before sort


## Examples

### Arrays:
`var data = new groupx({search_key:"create_time",sort:"week"}).sort([{ `&nbsp;
`  name:"Jamal1",` &nbsp;
`  create_time:1524758704`&nbsp;
`},{`&nbsp;
`  name:"Jamal2",`&nbsp;
  `create_time:1524860213`&nbsp;
`}]);`&nbsp;

console.log(data); // => `{"f":[1,1],"g":{"26":[ "data" ],"27":[
"data" ]},"v":[0,0,0,0,1,1,0],"y":[{"key":22,"results":0},{"key":23,"results":0},{"key":24,"results":0},{"key":25,"results":0},{"key":26,"results":1},{"key":27,"results":1},{"key":28,"results":0}],"x":[0,0,0,0,1,1,0]}`


### JSON:

`var data2 = new groupx({search_key:"create_time",sort:"week"}).sort({`&nbsp;
`  x:{`&nbsp;
`    key:"x",`&nbsp;
`    data:[{`&nbsp;
`      name:"Jamal1",`&nbsp;
 `     create_time:1524758704`&nbsp;
`    },{`&nbsp;
`      name:"Jamal2",`&nbsp;
`      create_time:1524860213`&nbsp;
`    }]`&nbsp;
`  },`&nbsp;
`  y:{`&nbsp;
`    key:"y",`&nbsp;
`    data:[{`&nbsp;
`      name:"Jamal1",`&nbsp;
`      create_time:1524758704`&nbsp;
`    },{`&nbsp;
`      name:"Jamal2",`&nbsp;
`     create_time:1524860213`&nbsp;
`    }]`&nbsp;
`  }`&nbsp;
`});`&nbsp;


console.log(data2); // => `[ { key: 22, x: 0, y: 0 },
  { key: 23, x: 0, y: 0 },
  { key: 24, x: 0, y: 0 },
  { key: 25, x: 0, y: 0 },
  { key: 26, x: 1, y: 1 },
  { key: 27, x: 1, y: 1 },
  { key: 28, x: 0, y: 0 } ]`



## License

[GPL-3.0](https://github.com/jamalabo1/mongo2sql/blob/master/LICENSE)

---
_Source: https://npm.io/package/groupx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
