@x-oasis/group-by 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"group-by.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["const hasOwnProperty = Object.prototype.hasOwnProperty\n/**\n * @param list the collection that the method iterates over.\n * @param fn the function that is invoked for every element in the array.\n * @returns\n */\nfunction groupBy(list: any[], fn: Function) {\n return list.reduce((acc, val) => {\n const key = fn(val)\n acc[key] = acc[key] || []\n acc[key].push(val)\n return acc\n }, {})\n}\n\nexport default groupBy\n"],"names":["groupBy","list","fn","reduce","acc","val","key","push"],"mappings":";;;;AAMA,SAASA,OAAOA,CAACC,IAAW,EAAEC,EAAY;EACxC,OAAOD,IAAI,CAACE,MAAM,CAAC,UAACC,GAAG,EAAEC,GAAG;IAC1B,IAAMC,GAAG,GAAGJ,EAAE,CAACG,GAAG,CAAC;IACnBD,GAAG,CAACE,GAAG,CAAC,GAAGF,GAAG,CAACE,GAAG,CAAC,IAAI,EAAE;IACzBF,GAAG,CAACE,GAAG,CAAC,CAACC,IAAI,CAACF,GAAG,CAAC;IAClB,OAAOD,GAAG;GACX,EAAE,EAAE,CAAC;AACR;;;;"}
1
+ {"version":3,"file":"group-by.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["const hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * @param list the collection that the method iterates over.\n * @param fn the function that is invoked for every element in the array.\n * @returns\n */\nfunction groupBy(list: any[], fn: Function) {\n return list.reduce((acc, val) => {\n const key = fn(val);\n acc[key] = acc[key] || [];\n acc[key].push(val);\n return acc;\n }, {});\n}\n\nexport default groupBy;\n"],"names":["groupBy","list","fn","reduce","acc","val","key","push"],"mappings":";;;;AAMA,SAASA,OAAOA,CAACC,IAAW,EAAEC,EAAY;EACxC,OAAOD,IAAI,CAACE,MAAM,CAAC,UAACC,GAAG,EAAEC,GAAG;IAC1B,IAAMC,GAAG,GAAGJ,EAAE,CAACG,GAAG,CAAC;IACnBD,GAAG,CAACE,GAAG,CAAC,GAAGF,GAAG,CAACE,GAAG,CAAC,IAAI,EAAE;IACzBF,GAAG,CAACE,GAAG,CAAC,CAACC,IAAI,CAACF,GAAG,CAAC;IAClB,OAAOD,GAAG;GACX,EAAE,EAAE,CAAC;AACR;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"group-by.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["const hasOwnProperty = Object.prototype.hasOwnProperty\n/**\n * @param list the collection that the method iterates over.\n * @param fn the function that is invoked for every element in the array.\n * @returns\n */\nfunction groupBy(list: any[], fn: Function) {\n return list.reduce((acc, val) => {\n const key = fn(val)\n acc[key] = acc[key] || []\n acc[key].push(val)\n return acc\n }, {})\n}\n\nexport default groupBy\n"],"names":["list","fn","reduce","acc","val","key","push"],"mappings":"oFAMA,SAAiBA,EAAaC,GAC5B,OAAOD,EAAKE,QAAO,SAACC,EAAKC,GACvB,IAAMC,EAAMJ,EAAGG,GAGf,OAFAD,EAAIE,GAAOF,EAAIE,IAAQ,GACvBF,EAAIE,GAAKC,KAAKF,GACPD,IACN"}
1
+ {"version":3,"file":"group-by.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["const hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * @param list the collection that the method iterates over.\n * @param fn the function that is invoked for every element in the array.\n * @returns\n */\nfunction groupBy(list: any[], fn: Function) {\n return list.reduce((acc, val) => {\n const key = fn(val);\n acc[key] = acc[key] || [];\n acc[key].push(val);\n return acc;\n }, {});\n}\n\nexport default groupBy;\n"],"names":["list","fn","reduce","acc","val","key","push"],"mappings":"oFAMA,SAAiBA,EAAaC,GAC5B,OAAOD,EAAKE,QAAO,SAACC,EAAKC,GACvB,IAAMC,EAAMJ,EAAGG,GAGf,OAFAD,EAAIE,GAAOF,EAAIE,IAAQ,GACvBF,EAAIE,GAAKC,KAAKF,GACPD,IACN"}
@@ -1 +1 @@
1
- {"version":3,"file":"group-by.esm.js","sources":["../src/index.ts"],"sourcesContent":["const hasOwnProperty = Object.prototype.hasOwnProperty\n/**\n * @param list the collection that the method iterates over.\n * @param fn the function that is invoked for every element in the array.\n * @returns\n */\nfunction groupBy(list: any[], fn: Function) {\n return list.reduce((acc, val) => {\n const key = fn(val)\n acc[key] = acc[key] || []\n acc[key].push(val)\n return acc\n }, {})\n}\n\nexport default groupBy\n"],"names":["groupBy","list","fn","reduce","acc","val","key","push"],"mappings":"AAMA,SAASA,OAAOA,CAACC,IAAW,EAAEC,EAAY;EACxC,OAAOD,IAAI,CAACE,MAAM,CAAC,UAACC,GAAG,EAAEC,GAAG;IAC1B,IAAMC,GAAG,GAAGJ,EAAE,CAACG,GAAG,CAAC;IACnBD,GAAG,CAACE,GAAG,CAAC,GAAGF,GAAG,CAACE,GAAG,CAAC,IAAI,EAAE;IACzBF,GAAG,CAACE,GAAG,CAAC,CAACC,IAAI,CAACF,GAAG,CAAC;IAClB,OAAOD,GAAG;GACX,EAAE,EAAE,CAAC;AACR;;;;"}
1
+ {"version":3,"file":"group-by.esm.js","sources":["../src/index.ts"],"sourcesContent":["const hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * @param list the collection that the method iterates over.\n * @param fn the function that is invoked for every element in the array.\n * @returns\n */\nfunction groupBy(list: any[], fn: Function) {\n return list.reduce((acc, val) => {\n const key = fn(val);\n acc[key] = acc[key] || [];\n acc[key].push(val);\n return acc;\n }, {});\n}\n\nexport default groupBy;\n"],"names":["groupBy","list","fn","reduce","acc","val","key","push"],"mappings":"AAMA,SAASA,OAAOA,CAACC,IAAW,EAAEC,EAAY;EACxC,OAAOD,IAAI,CAACE,MAAM,CAAC,UAACC,GAAG,EAAEC,GAAG;IAC1B,IAAMC,GAAG,GAAGJ,EAAE,CAACG,GAAG,CAAC;IACnBD,GAAG,CAACE,GAAG,CAAC,GAAGF,GAAG,CAACE,GAAG,CAAC,IAAI,EAAE;IACzBF,GAAG,CAACE,GAAG,CAAC,CAACC,IAAI,CAACF,GAAG,CAAC;IAClB,OAAOD,GAAG;GACX,EAAE,EAAE,CAAC;AACR;;;;"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@x-oasis/group-by",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "groupBy function",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
- "module": "dist/groupBy.esm.js",
7
+ "module": "dist/group-by.esm.js",
8
8
  "files": [
9
9
  "dist",
10
10
  "index.ts",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- const hasOwnProperty = Object.prototype.hasOwnProperty
1
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
2
2
  /**
3
3
  * @param list the collection that the method iterates over.
4
4
  * @param fn the function that is invoked for every element in the array.
@@ -6,11 +6,11 @@ const hasOwnProperty = Object.prototype.hasOwnProperty
6
6
  */
7
7
  function groupBy(list: any[], fn: Function) {
8
8
  return list.reduce((acc, val) => {
9
- const key = fn(val)
10
- acc[key] = acc[key] || []
11
- acc[key].push(val)
12
- return acc
13
- }, {})
9
+ const key = fn(val);
10
+ acc[key] = acc[key] || [];
11
+ acc[key].push(val);
12
+ return acc;
13
+ }, {});
14
14
  }
15
15
 
16
- export default groupBy
16
+ export default groupBy;