Skip to content

Commit 22d07cd

Browse files
committed
feat!: drop @s3xysteak/utils/imports. Use { package: '@s3xysteak/utils' } instead.
1 parent e025b5e commit 22d07cd

File tree

7 files changed

+43
-71
lines changed

7 files changed

+43
-71
lines changed

package.json

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,16 @@
2020
"exports": {
2121
".": {
2222
"types": "./dist/index.d.ts",
23-
"import": "./dist/index.mjs",
24-
"require": "./dist/index.cjs"
25-
},
26-
"./import": {
27-
"import": {
28-
"types": "./dist/import.d.ts",
29-
"default": "./dist/import.mjs"
30-
},
31-
"require": {
32-
"types": "./dist/import.d.ts",
33-
"default": "./dist/import.cjs"
34-
}
23+
"import": "./dist/index.js"
3524
}
3625
},
37-
"main": "./dist/index.cjs",
38-
"module": "./dist/index.mjs",
3926
"types": "./dist/index.d.ts",
40-
"files": [
41-
"dist"
42-
],
27+
"files": ["dist"],
4328
"publishConfig": {
4429
"registry": "https://registry.npmjs.org/"
4530
},
4631
"scripts": {
47-
"build": "esno ./scripts/update-import.ts && tsdown",
32+
"build": "tsdown",
4833
"typecheck": "tsc --noEmit",
4934
"test": "vitest",
5035
"test:once": "vitest run",
@@ -53,9 +38,6 @@
5338
"lint": "eslint .",
5439
"lint:fix": "eslint . --fix"
5540
},
56-
"dependencies": {
57-
"auto-import-helper": "^0.2.0"
58-
},
5941
"devDependencies": {
6042
"@antfu/eslint-config": "^5.3.0",
6143
"@types/node": "^24.3.1",
@@ -65,12 +47,5 @@
6547
"tsdown": "^0.15.0",
6648
"typescript": "^5.9.2",
6749
"vitest": "^3.2.4"
68-
},
69-
"pnpm": {
70-
"peerDependencyRules": {
71-
"allowedVersions": {
72-
"eslint": "9"
73-
}
74-
}
7550
}
7651
}

pnpm-lock.yaml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/update-import.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/core/array.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
const isString = (val: unknown): val is string => typeof val === 'string'
22
const isUndefined = (val: any): val is undefined => Object.prototype.toString.call(val) === '[object Undefined]'
3+
4+
/**
5+
* Classification by specified method
6+
*
7+
* @example
8+
* expect(
9+
* groupBy([
10+
* { type: 'apple', size: 2 },
11+
* { type: 'banana', size: 3 },
12+
* { type: 'pear', size: 2 },
13+
* { type: 'mango', size: 1 },
14+
* { type: 'apple', size: 4 },
15+
* { type: 'banana', size: 6 },
16+
* { type: 'pear', size: 6, special: true },
17+
* ], 'type') // or use `item => item.type` instead of `'type'`
18+
* ).toEqual({
19+
* apple: [
20+
* { type: 'apple', size: 2 },
21+
* { type: 'apple', size: 4 },
22+
* ],
23+
* banana: [
24+
* { type: 'banana', size: 3 },
25+
* { type: 'banana', size: 6 },
26+
* ],
27+
* pear: [
28+
* { type: 'pear', size: 2 },
29+
* { type: 'pear', size: 6, special: true },
30+
* ],
31+
* mango: [
32+
* { type: 'mango', size: 1 },
33+
* ],
34+
* })
35+
*/
336
export function groupBy<T extends any[]>(arr: T, getKey: string | ((element: T[number], index: number) => PropertyKey)) {
437
const val: Record<PropertyKey, T[number]> = {}
538

src/core/index.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/import.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
export * from './core'
1+
export * from './core/array'
2+
export * from './core/base'
3+
export * from './core/fp'
4+
export * from './core/is'
5+
export * from './core/number'
6+
export * from './core/promise'
7+
export * from './core/types'

0 commit comments

Comments
 (0)