@febin52/group-by-fast 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1 @@
1
+ MIT License
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # 🗂️ @febin52/group-by-fast
2
+
3
+ > Group array items by key.
4
+
5
+ ```ts
6
+ import { groupBy } from '@febin52/group-by-fast';
7
+ groupBy([6.1, 4.2, 6.3], Math.floor); // { '4': [4.2], '6': [6.1, 6.3] }
8
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.Pkg={}))})(this,function(e){"use strict";function n(i,f){return i.reduce((t,o)=>{const u=f(o);return(t[u]=t[u]||[]).push(o),t},{})}e.groupBy=n,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,3 @@
1
+ export declare function groupBy<T, K extends string | number | symbol>(arr: T[], fn: (item: T) => K): Record<K, T[]>;
2
+
3
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ function t(n, o) {
2
+ return n.reduce((r, u) => {
3
+ const e = o(u);
4
+ return (r[e] = r[e] || []).push(u), r;
5
+ }, {});
6
+ }
7
+ export {
8
+ t as groupBy
9
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@febin52/group-by-fast",
3
+ "version": "1.0.0",
4
+ "description": "Group array elements by key or accessor function.",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc && vite build",
22
+ "test": "vitest run"
23
+ },
24
+ "keywords": [
25
+ "group",
26
+ "groupBy",
27
+ "array",
28
+ "organize",
29
+ "dictionary"
30
+ ],
31
+ "author": "Febin Francis",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/febin52/group-by-fast.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/febin52/group-by-fast/issues"
39
+ },
40
+ "homepage": "https://github.com/febin52/group-by-fast#readme"
41
+ }