speexjs-core 0.7.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/CHANGELOG.md +117 -0
- package/CONTRIBUTING.md +55 -0
- package/PUBLISH.md +45 -0
- package/README.md +174 -0
- package/ROADMAP.md +72 -0
- package/SECURITY.md +35 -0
- package/SUMMARY.md +321 -0
- package/dist/async/index.d.ts +232 -0
- package/dist/async/index.js +366 -0
- package/dist/async/index.js.map +1 -0
- package/dist/collection/index.d.ts +230 -0
- package/dist/collection/index.js +375 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color/index.d.ts +128 -0
- package/dist/color/index.js +167 -0
- package/dist/color/index.js.map +1 -0
- package/dist/core/index.d.ts +119 -0
- package/dist/core/index.js +324 -0
- package/dist/core/index.js.map +1 -0
- package/dist/crypto/index.d.ts +84 -0
- package/dist/crypto/index.js +144 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/date/index.d.ts +588 -0
- package/dist/date/index.js +737 -0
- package/dist/date/index.js.map +1 -0
- package/dist/dep-exray/analyzer/index.d.ts +7 -0
- package/dist/dep-exray/analyzer/index.js +68 -0
- package/dist/dep-exray/analyzer/index.js.map +1 -0
- package/dist/dep-exray/cli.d.ts +1 -0
- package/dist/dep-exray/cli.js +441 -0
- package/dist/dep-exray/cli.js.map +1 -0
- package/dist/dep-exray/index.d.ts +5 -0
- package/dist/dep-exray/index.js +454 -0
- package/dist/dep-exray/index.js.map +1 -0
- package/dist/dep-exray/known-mappings.d.ts +17 -0
- package/dist/dep-exray/known-mappings.js +122 -0
- package/dist/dep-exray/known-mappings.js.map +1 -0
- package/dist/dep-exray/reporter/index.d.ts +5 -0
- package/dist/dep-exray/reporter/index.js +89 -0
- package/dist/dep-exray/reporter/index.js.map +1 -0
- package/dist/dep-exray/scanner/index.d.ts +5 -0
- package/dist/dep-exray/scanner/index.js +299 -0
- package/dist/dep-exray/scanner/index.js.map +1 -0
- package/dist/dep-exray/types.d.ts +38 -0
- package/dist/dep-exray/types.js +1 -0
- package/dist/dep-exray/types.js.map +1 -0
- package/dist/error/index.d.ts +148 -0
- package/dist/error/index.js +115 -0
- package/dist/error/index.js.map +1 -0
- package/dist/index-BgG21uJC.d.ts +166 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +4378 -0
- package/dist/index.js.map +1 -0
- package/dist/io/index.d.ts +39 -0
- package/dist/io/index.js +111 -0
- package/dist/io/index.js.map +1 -0
- package/dist/logger/index.d.ts +1 -0
- package/dist/logger/index.js +214 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/transports.d.ts +1 -0
- package/dist/logger/transports.js +122 -0
- package/dist/logger/transports.js.map +1 -0
- package/dist/math/index.d.ts +362 -0
- package/dist/math/index.js +372 -0
- package/dist/math/index.js.map +1 -0
- package/dist/path/index.d.ts +81 -0
- package/dist/path/index.js +134 -0
- package/dist/path/index.js.map +1 -0
- package/dist/string/index.d.ts +234 -0
- package/dist/string/index.js +411 -0
- package/dist/string/index.js.map +1 -0
- package/dist/type/index.d.ts +85 -0
- package/dist/type/index.js +107 -0
- package/dist/type/index.js.map +1 -0
- package/dist/validation/index.d.ts +203 -0
- package/dist/validation/index.js +402 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +172 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.4.4] - 2026-06-28
|
|
4
|
+
|
|
5
|
+
### Diubah
|
|
6
|
+
- Semua markdown file dipindah ke packages/core/ dan include di npm package
|
|
7
|
+
- `files` di package.json: nambah `"*.md"` biar dokumentasi ikut ter-publish
|
|
8
|
+
|
|
9
|
+
## [0.4.3] - 2026-06-28
|
|
10
|
+
|
|
11
|
+
### Diubah
|
|
12
|
+
- Markdown file dipindah dari root ke packages/core/
|
|
13
|
+
|
|
14
|
+
## [0.4.2] - 2026-06-28
|
|
15
|
+
|
|
16
|
+
### Ditambahkan
|
|
17
|
+
- **validation** — `parseNIK()` extract data dari NIK (gender, provinsi, tanggal lahir)
|
|
18
|
+
- **validation** — `isPlatNomor()` validasi plat kendaraan Indonesia (B 1234 CD)
|
|
19
|
+
- **validation** — `isKodepos()` validasi kode pos Indonesia (5 digit)
|
|
20
|
+
- **validation** — `isNoRekening()` validasi nomor rekening bank (8-16 digit)
|
|
21
|
+
- 828 total tests (19 test files)
|
|
22
|
+
|
|
23
|
+
## [0.4.1] - 2026-06-28
|
|
24
|
+
|
|
25
|
+
### Diubah
|
|
26
|
+
- Semua dokumentasi pake Bahasa Indonesia
|
|
27
|
+
- Description npm: fokus ke developer Indonesia
|
|
28
|
+
|
|
29
|
+
## [0.4.0] - 2026-06-28
|
|
30
|
+
|
|
31
|
+
### Ditambahkan
|
|
32
|
+
- **color module** — `hexToRgb()`, `rgbToHex()`, `lighten()`, `darken()`, `contrastRatio()`, `meetsWCAG()`
|
|
33
|
+
- **core** — `deepEqual()` (deep equality), `pipe()`, `compose()` (function composition)
|
|
34
|
+
- **string** — `formatBytes()`, `randomString()`, `randomBoolean()`, `pluralize()`
|
|
35
|
+
- **collection** — `deepGet()`, `deepSet()` (nested object path access)
|
|
36
|
+
- 810 total tests (18 test files)
|
|
37
|
+
|
|
38
|
+
### Diubah
|
|
39
|
+
- Semua dokumentasi pake Bahasa Indonesia
|
|
40
|
+
|
|
41
|
+
## [0.3.9] - 2026-06-28
|
|
42
|
+
|
|
43
|
+
### Diubah
|
|
44
|
+
- README pake Bahasa Inggris (dulu Indonesia)
|
|
45
|
+
- Description npm diupdate
|
|
46
|
+
|
|
47
|
+
## [0.3.6] - 2026-06-28
|
|
48
|
+
|
|
49
|
+
### Diubah
|
|
50
|
+
- 810 total tests (dari 484) — nambah brutal audit suite 273 edge-case tests
|
|
51
|
+
- SUMMARY.md dibuat — dokumentasi fitur lengkap semua module
|
|
52
|
+
|
|
53
|
+
### Dibenerin
|
|
54
|
+
- 6 bug ditemukan pas brutal audit
|
|
55
|
+
- Semua prototype pollution, ReDoS, crypto tests terverifikasi
|
|
56
|
+
|
|
57
|
+
## [0.3.5] - 2026-06-28
|
|
58
|
+
|
|
59
|
+
### Ditambahkan (Ekspansi P1)
|
|
60
|
+
- **async**: Queue (priority task queue), Semaphore, memoizeAsync (stale-while-revalidate)
|
|
61
|
+
- **math**: median, stddev, sampleStddev, percentile, correlation, formatCurrency
|
|
62
|
+
- **string**: levenshtein, fuzzyMatch, maskString (PDPA compliance), terbilang (angka→kata), formatRupiah
|
|
63
|
+
- **collection**: topoSort (Kahn's algorithm), slidingWindows, tumblingWindows
|
|
64
|
+
- **date**: timeAgo (id/en), timeRemaining, Duration, formatDuration, toTimezone, formatInTimezone, WIB/WITA/WIT constants
|
|
65
|
+
|
|
66
|
+
## [0.3.4] - 2026-06-28
|
|
67
|
+
|
|
68
|
+
### Ditambahkan (Modul P0)
|
|
69
|
+
- **validation**: isNIK, isNPWP, isPhone, isEmail, isURL — validasi khusus Indonesia
|
|
70
|
+
- **error**: createError, TypedError (10 codes + HTTP status), MultiError, collectErrors
|
|
71
|
+
- **logger**: Logger class, child loggers, console/JSON/file transports, buffered transport
|
|
72
|
+
- 16 modules total, 484 tests passing
|
|
73
|
+
|
|
74
|
+
## [0.3.3] - 2026-06-28
|
|
75
|
+
|
|
76
|
+
### Dibenerin
|
|
77
|
+
- `round(1.005, 2)` floating-point bug
|
|
78
|
+
- `parseDate('29/02/2023')` gak throw buat invalid leap year
|
|
79
|
+
- Nambah `sideEffects: false` buat tree-shaking optimal
|
|
80
|
+
|
|
81
|
+
## [0.3.2] - 2026-06-28
|
|
82
|
+
|
|
83
|
+
### Ditambahkan
|
|
84
|
+
- Biome linter + formatter config
|
|
85
|
+
- CI workflow dengan matrix testing (Node 18, 20, 22)
|
|
86
|
+
- SECURITY.md buat vulnerability disclosure
|
|
87
|
+
- CHANGELOG.md
|
|
88
|
+
|
|
89
|
+
### Dibenerin
|
|
90
|
+
- Cross-platform `clean` script
|
|
91
|
+
- GitHub Actions: dep-exray-scan pake speedx-core
|
|
92
|
+
- Hapus keyword "zero-dependency" yang misleading
|
|
93
|
+
|
|
94
|
+
## [0.3.0] - 2026-06-27
|
|
95
|
+
|
|
96
|
+
### Diubah
|
|
97
|
+
- `speedx-dep-exray` digabung ke `speedx-core` jadi module built-in
|
|
98
|
+
- Satu package: `npm install speedx-core` dapet semua
|
|
99
|
+
- 7 npm packages di-unpublish/deprecate
|
|
100
|
+
|
|
101
|
+
### Ditambahkan
|
|
102
|
+
- `dep-exray` module: scanProject, analyzeUsage, generateReport
|
|
103
|
+
- CLI: `npx dep-exray .`
|
|
104
|
+
|
|
105
|
+
## [0.2.0] - 2026-06-27
|
|
106
|
+
|
|
107
|
+
### Ditambahkan
|
|
108
|
+
- crypto module: hash, randomHex, base64, generateToken, generateOTP
|
|
109
|
+
- path module: join, resolve, basename, dirname, extname
|
|
110
|
+
|
|
111
|
+
## [0.1.0] - 2026-06-27
|
|
112
|
+
|
|
113
|
+
### Ditambahkan
|
|
114
|
+
- Initial release
|
|
115
|
+
- core, math, date, collection, string, async, io, type modules
|
|
116
|
+
- 100+ utility functions
|
|
117
|
+
- Full TypeScript strict mode
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Kontribusi ke speedx-core
|
|
2
|
+
|
|
3
|
+
## Setup Development
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
cd packages/core
|
|
7
|
+
npm install
|
|
8
|
+
npx tsup
|
|
9
|
+
npx vitest run
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Cara Nambah Fungsi Baru
|
|
13
|
+
|
|
14
|
+
1. Tambah fungsi di module yang sesuai `packages/core/src/<module>/`
|
|
15
|
+
2. Export dari `index.ts` module tersebut
|
|
16
|
+
3. Tambah test di `packages/core/tests/`
|
|
17
|
+
4. Jalankan `npx vitest run` (828 tests harus passing)
|
|
18
|
+
5. Jalankan `npx tsup` biar build sukses
|
|
19
|
+
6. Update `SUMMARY.md` sama `README.md`
|
|
20
|
+
|
|
21
|
+
## Module yang Tersedia
|
|
22
|
+
|
|
23
|
+
| Module | Lokasi |
|
|
24
|
+
|--------|--------|
|
|
25
|
+
| core | `src/core/` |
|
|
26
|
+
| math | `src/math/` |
|
|
27
|
+
| date | `src/date/` |
|
|
28
|
+
| collection | `src/collection/` |
|
|
29
|
+
| string | `src/string/` |
|
|
30
|
+
| async | `src/async/` |
|
|
31
|
+
| io | `src/io/` |
|
|
32
|
+
| type | `src/type/` |
|
|
33
|
+
| crypto | `src/crypto/` |
|
|
34
|
+
| path | `src/path/` |
|
|
35
|
+
| color | `src/color/` |
|
|
36
|
+
| validation | `src/validation/` |
|
|
37
|
+
| error | `src/error/` |
|
|
38
|
+
| logger | `src/logger/` |
|
|
39
|
+
| dep-exray | `src/dep-exray/` |
|
|
40
|
+
|
|
41
|
+
## Aturan Commit
|
|
42
|
+
|
|
43
|
+
Pake [Conventional Commits](https://www.conventionalcommits.org/):
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
feat(core): nambah deepMerge function
|
|
47
|
+
fix(math): benerin floating point rounding
|
|
48
|
+
docs: update README
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Pull Request
|
|
52
|
+
|
|
53
|
+
1. Bikin branch dari `master`
|
|
54
|
+
2. Pastikan `npx tsup && npx vitest run` lolos
|
|
55
|
+
3. Buka PR ke `master` dengan judul dan deskripsi jelas
|
package/PUBLISH.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Panduan Publishing
|
|
2
|
+
|
|
3
|
+
## Prasyarat
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm login
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Cara Publish speedx-core
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
cd packages/core
|
|
13
|
+
|
|
14
|
+
# 1. Build
|
|
15
|
+
npx tsup
|
|
16
|
+
|
|
17
|
+
# 2. Test (828 tests)
|
|
18
|
+
npx vitest run
|
|
19
|
+
|
|
20
|
+
# 3. Bump version
|
|
21
|
+
npm version patch
|
|
22
|
+
# atau: npm version minor
|
|
23
|
+
# atau: npm version major
|
|
24
|
+
|
|
25
|
+
# 4. Build ulang setelah version bump
|
|
26
|
+
npx tsup
|
|
27
|
+
|
|
28
|
+
# 5. Publish ke npm
|
|
29
|
+
npm publish
|
|
30
|
+
|
|
31
|
+
# 6. Commit dan push ke GitHub
|
|
32
|
+
cd ../..
|
|
33
|
+
git add -A
|
|
34
|
+
git commit -m "chore: bump ke v$(node -p \"require('./packages/core/package.json').version\")"
|
|
35
|
+
git push origin master
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Checklist Sebelum Publish
|
|
39
|
+
|
|
40
|
+
- [ ] `npx tsup` — build sukses
|
|
41
|
+
- [ ] `npx vitest run` — 828 tests pass
|
|
42
|
+
- [ ] `npm login` — udah login
|
|
43
|
+
- [ ] Changelog udah diupdate
|
|
44
|
+
- [ ] README udah sesuai
|
|
45
|
+
- [ ] Git commit — semua perubahan ter-commit
|
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# speedx-core
|
|
2
|
+
|
|
3
|
+
> **JavaScript toolkit all-in-one buat developer Indonesia — Standard Library + Dependency Scanner + 🇮🇩 Validasi NIK/NPWP/Phone + Logger + Typed Errors**
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install speedx-core
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Satu package buat semua kebutuhan JavaScript lo: utility functions, async helpers, crypto, path manipulation, typed errors, structured logging, **plus** dependency health scanner dan validasi data Indonesia (NIK, NPWP, Phone).
|
|
10
|
+
|
|
11
|
+
**100% buat programmer Indonesia. Zero dependency runtime.**
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Fitur Unggulan 🇮🇩
|
|
16
|
+
|
|
17
|
+
| Fitur | Fungsi |
|
|
18
|
+
|-------|--------|
|
|
19
|
+
| **Validasi NIK** | `isNIK('3201010203940001')` — validasi 16 digit + tanggal lahir |
|
|
20
|
+
| **Parse NIK** | `parseNIK('320101...')` — extract gender, provinsi, tanggal lahir |
|
|
21
|
+
| **Validasi NPWP** | `isNPWP('12.345.678.9-012.344')` — dengan checksum otomatis |
|
|
22
|
+
| **Validasi Plat Nomor** | `isPlatNomor('B 1234 CD')` — validasi plat kendaraan |
|
|
23
|
+
| **Validasi Nomor HP** | `isPhone('08123456789')` — support semua prefix Indonesia |
|
|
24
|
+
| **Validasi Kode Pos** | `isKodepos('16110')` — validasi kode pos 5 digit |
|
|
25
|
+
| **Validasi No. Rekening** | `isNoRekening('1234567890')` — validasi 8-16 digit |
|
|
26
|
+
| **Terbilang** | `terbilang(1500000)` → "satu juta lima ratus ribu" |
|
|
27
|
+
| **Format Rupiah** | `formatRupiah(1500000)` → "Rp1.500.000" |
|
|
28
|
+
| **Format Waktu** | `timeAgo(new Date(...))` → "5 detik yang lalu" |
|
|
29
|
+
| **Timezone WIB/WITA/WIT** | `formatInTimezone(date, 'HH', TIMEZONE_WIB)` → "07" |
|
|
30
|
+
| **Dependency Scanner** | `npx dep-exray .` — scan project lo |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 16 Modules
|
|
35
|
+
|
|
36
|
+
| Module | Fungsi Unggulan |
|
|
37
|
+
|--------|----------------|
|
|
38
|
+
| **core** | deepClone, deepMerge, debounce, deepEqual, pipe, throttle, memoize |
|
|
39
|
+
| **math** | add/sub/mul/div (safe float), median, stddev, percentile, formatCurrency |
|
|
40
|
+
| **date** | formatDate, timeAgo, Duration, timezone helpers (WIB/WITA/WIT) |
|
|
41
|
+
| **collection** | sortBy, groupBy, shuffle, topoSort, slidingWindows, deepGet, deepSet |
|
|
42
|
+
| **string** | camelCase, uuid, nanoid, slugify, **terbilang**, **formatRupiah**, maskString, formatBytes |
|
|
43
|
+
| **async** | sleep, parallelMap, Queue, Semaphore, memoizeAsync, retryAsync |
|
|
44
|
+
| **io** | parseCsv, stringifyCsv, safeJsonParse, env |
|
|
45
|
+
| **type** | 20+ type guards (isString, isNil, assertDefined, getType) |
|
|
46
|
+
| **crypto** | hash, base64, generateToken, generateOTP, constantTimeEqual |
|
|
47
|
+
| **path** | join, resolve, basename, dirname, extname, normalize |
|
|
48
|
+
| **color** | hexToRgb, rgbToHex, lighten, darken, contrastRatio, meetsWCAG |
|
|
49
|
+
| **validation** | **isNIK**, **parseNIK**, **isNPWP**, **isPlatNomor**, **isPhone**, **isKodepos**, **isNoRekening**, isEmail, isURL |
|
|
50
|
+
| **error** | createError (typed + HTTP status), TypedError, MultiError |
|
|
51
|
+
| **logger** | Logger class, child loggers, console/JSON/file transports |
|
|
52
|
+
| **dep-exray** | scanProject, generateReport, analyzeUsage, CLI: `npx dep-exray .` |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Contoh Kode
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { deepClone } from "speedx-core"
|
|
60
|
+
import { formatDate, timeAgo, TIMEZONE_WIB } from "speedx-core/date"
|
|
61
|
+
import { Queue } from "speedx-core/async"
|
|
62
|
+
import { uuid, maskString, terbilang, formatRupiah, formatBytes } from "speedx-core/string"
|
|
63
|
+
import { isNIK, isNPWP, isPhone } from "speedx-core/validation"
|
|
64
|
+
import { createError } from "speedx-core/error"
|
|
65
|
+
import { Logger } from "speedx-core/logger"
|
|
66
|
+
import { hexToRgb, contrastRatio } from "speedx-core/color"
|
|
67
|
+
|
|
68
|
+
// Validasi data Indonesia
|
|
69
|
+
isNIK("3201010203940001") // true
|
|
70
|
+
isNPWP("12.345.678.9-012.344") // true
|
|
71
|
+
isPhone("08123456789") // true
|
|
72
|
+
|
|
73
|
+
// Konversi angka ke kata
|
|
74
|
+
terbilang(1500000) // "satu juta lima ratus ribu"
|
|
75
|
+
formatRupiah(1500000) // "Rp1.500.000"
|
|
76
|
+
|
|
77
|
+
// Relative time
|
|
78
|
+
timeAgo(new Date(Date.now() - 5000)) // "5 detik yang lalu"
|
|
79
|
+
|
|
80
|
+
// Mask data sensitif (PDPA compliance)
|
|
81
|
+
maskString("08123456789") // "081*****789"
|
|
82
|
+
|
|
83
|
+
// Format file size
|
|
84
|
+
formatBytes(1048576) // "1 MB"
|
|
85
|
+
|
|
86
|
+
// Color utilities
|
|
87
|
+
hexToRgb("#ff0000") // { r: 255, g: 0, b: 0 }
|
|
88
|
+
contrastRatio("#000000", "#ffffff") // 21
|
|
89
|
+
|
|
90
|
+
// Typed errors
|
|
91
|
+
throw createError("VALIDATION_ERROR", "Email wajib diisi")
|
|
92
|
+
|
|
93
|
+
// Structured logger
|
|
94
|
+
const log = new Logger({ level: "info", name: "app" })
|
|
95
|
+
log.info("Server started", { port: 3000 })
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## dep-exray — Dependency Health Scanner
|
|
101
|
+
|
|
102
|
+
**Scan project lo buat nemuin dependency yang gak kepake, bloated, atau punya CVE.**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx dep-exray .
|
|
106
|
+
npx dep-exray /path/to/project --json --verbose
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Fitur
|
|
110
|
+
- Deteksi replacement: lodash → speedx-core, moment → speedx-core/date, uuid → native crypto.randomUUID()
|
|
111
|
+
- Estimasi ukuran dependency
|
|
112
|
+
- CVE detection
|
|
113
|
+
- JSON output untuk CI/CD
|
|
114
|
+
- Usage analyzer
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Quick Start
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/superdevids/speedx.git
|
|
122
|
+
cd speedx/packages/core
|
|
123
|
+
npm install
|
|
124
|
+
npx tsup # Build
|
|
125
|
+
npx vitest run # Test (828 tests)
|
|
126
|
+
npx dep-exray . # Scan project sendiri
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Statistik Test
|
|
132
|
+
|
|
133
|
+
| File Tes | Jumlah |
|
|
134
|
+
|----------|--------|
|
|
135
|
+
| 19 file | **828** passing ✅ |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Struktur Project
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
packages/core/
|
|
143
|
+
├── src/
|
|
144
|
+
│ ├── core/ # deepClone, debounce, deepEqual, pipe
|
|
145
|
+
│ ├── math/ # add, median, stddev, formatCurrency
|
|
146
|
+
│ ├── date/ # formatDate, timeAgo, Duration, WIB/WITA/WIT
|
|
147
|
+
│ ├── collection/ # groupBy, topoSort, deepGet, deepSet
|
|
148
|
+
│ ├── string/ # camelCase, terbilang, formatRupiah
|
|
149
|
+
│ ├── async/ # sleep, Queue, Semaphore, memoizeAsync
|
|
150
|
+
│ ├── io/ # parseCsv, safeJsonParse, env
|
|
151
|
+
│ ├── type/ # 20+ type guards
|
|
152
|
+
│ ├── crypto/ # hash, generateToken, base64
|
|
153
|
+
│ ├── path/ # join, resolve, basename
|
|
154
|
+
│ ├── color/ # hexToRgb, lighten, darken, contrastRatio
|
|
155
|
+
│ ├── validation/ # isNIK, parseNIK, isNPWP, isPlatNomor, isPhone, isKodepos, isNoRekening, isEmail, isURL
|
|
156
|
+
│ ├── error/ # createError, TypedError, MultiError
|
|
157
|
+
│ ├── logger/ # Logger, transports
|
|
158
|
+
│ └── dep-exray/ # Dependency scanner
|
|
159
|
+
├── tests/ # 828 tests
|
|
160
|
+
├── dist/ # Hasil build
|
|
161
|
+
└── package.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Roadmap
|
|
167
|
+
|
|
168
|
+
Lihat [ROADMAP.md](./ROADMAP.md) untuk detail lengkap.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
package/ROADMAP.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Roadmap SpeedX Core
|
|
2
|
+
|
|
3
|
+
## v0.4.0 — Modul Indonesia & Error Foundation ✅ (Selesai)
|
|
4
|
+
|
|
5
|
+
### Modul Baru
|
|
6
|
+
- ✅ **validation** — `isNIK()`, `parseNIK()`, `isNPWP()`, `isPlatNomor()`, `isPhone("id")`, `isKodepos()`, `isNoRekening()`, `isEmail()`, `isURL()` — zero-dep, khusus Indonesia
|
|
7
|
+
- ✅ **error** — `createError()` factory, `MultiError`, typed error codes
|
|
8
|
+
- ✅ **logger** — Structured logger zero-dep, child loggers, file transport
|
|
9
|
+
- ✅ **color** — `hexToRgb()`, `lighten()`, `darken()`, `contrastRatio()`, `meetsWCAG()`
|
|
10
|
+
|
|
11
|
+
### Ekspansi Modul Existing
|
|
12
|
+
- ✅ **core** — `deepEqual()`, `pipe()`, `compose()`
|
|
13
|
+
- ✅ **string** — `maskString()`, `levenshtein()`, `fuzzyMatch()`, `terbilang()`, `formatRupiah()`, `formatBytes()`, `pluralize()`
|
|
14
|
+
- ✅ **math** — `median()`, `stddev()`, `percentile()`, `correlation()`, `formatCurrency()`
|
|
15
|
+
- ✅ **async** — `Queue()`, `Semaphore`, `memoizeAsync()`
|
|
16
|
+
- ✅ **collection** — `topoSort()` (Kahn), `slidingWindows()`, `deepGet()`, `deepSet()`
|
|
17
|
+
- ✅ **date** — `timeAgo()`, `Duration`, `formatDuration()`, `toTimezone()`, WIB/WITA/WIT
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## v0.5.0 — Production Toolkit (Next)
|
|
22
|
+
|
|
23
|
+
### Ekspansi
|
|
24
|
+
- **validation** — Tambah `isEmail()` detail check, `isURL()` lebih ketat
|
|
25
|
+
- **io** — `parseJSONL()`, streaming CSV parser
|
|
26
|
+
- **crypto** — AES-GCM encrypt/decrypt, HMAC signing, hapus xorCipher
|
|
27
|
+
|
|
28
|
+
### Infrastructure
|
|
29
|
+
- TypeDoc generated API docs (biar gampang referensi)
|
|
30
|
+
- Benchmark suite vs lodash/moment
|
|
31
|
+
- VS Code Extension publish ke Marketplace
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## v0.6.0 — Advanced
|
|
36
|
+
|
|
37
|
+
### Modul Baru
|
|
38
|
+
- **signal** — Reactive primitives: `signal()`, `computed()`, `effect()` — framework-agnostic
|
|
39
|
+
- **ml** — `cosineSimilarity()`, confusion matrix, F1 score, k-means clustering
|
|
40
|
+
|
|
41
|
+
### Ekspansi
|
|
42
|
+
- **crypto** — JWT lite buat edge runtime
|
|
43
|
+
- **type** — Schema validation lite
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## v1.0.0 — Stable API
|
|
48
|
+
|
|
49
|
+
- API freeze — no breaking changes setelah v1.0
|
|
50
|
+
- Dependabot + Renovate configured
|
|
51
|
+
- Co-maintainer onboarding
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Prioritas Matrix
|
|
56
|
+
|
|
57
|
+
| Item | Impact | Effort | Priority |
|
|
58
|
+
|------|--------|--------|----------|
|
|
59
|
+
| validation module (isNIK, isNPWP, isPhone) | 🔥🔥🔥 | 🟢 Small | ✅ P0 |
|
|
60
|
+
| error module | 🔥🔥🔥 | 🟢 Small | ✅ P0 |
|
|
61
|
+
| logger module | 🔥🔥🔥 | 🟢 Small | ✅ P0 |
|
|
62
|
+
| color module | 🔥🔥 | 🟢 Small | ✅ P0 |
|
|
63
|
+
| string: terbilang, formatRupiah, maskString | 🔥🔥🔥 | 🟢 Small | ✅ P0 |
|
|
64
|
+
| math: median, stddev, percentile | 🔥🔥 | 🟢 Small | ✅ P1 |
|
|
65
|
+
| async: Queue, Semaphore | 🔥🔥 | 🟡 Medium | ✅ P1 |
|
|
66
|
+
| core: pipe, compose, deepEqual | 🔥🔥🔥 | 🟡 Medium | ✅ P1 |
|
|
67
|
+
| collection: topoSort, deepGet, deepSet | 🔥🔥 | 🟡 Medium | ✅ P1 |
|
|
68
|
+
| date: timeAgo, Duration, tz helpers | 🔥🔥 | 🟡 Medium | ✅ P1 |
|
|
69
|
+
| io: JSONL parser, streaming CSV | 🔥🔥 | 🟡 Medium | P2 |
|
|
70
|
+
| crypto: AES-GCM, HMAC, JWT | 🔥🔥🔥 | 🔴 Large | P2 |
|
|
71
|
+
| signal module | 🔥🔥 | 🔴 Large | P2 |
|
|
72
|
+
| ml module | 🔥🔥 | 🔴 Large | P3 |
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Kebijakan Keamanan
|
|
2
|
+
|
|
3
|
+
## Melaporkan Kerentanan
|
|
4
|
+
|
|
5
|
+
Kalau lo nemu celah keamanan di speedx-core, lapor lewat email: adityasuperdev@gmail.com
|
|
6
|
+
|
|
7
|
+
**JANGAN bikin GitHub issue publik untuk kerentanan keamanan.**
|
|
8
|
+
|
|
9
|
+
Lo bakal dapet respon dalam 48 jam. Kalo belum ada kabar, follow-up lewat email.
|
|
10
|
+
|
|
11
|
+
## Yang Perlu Disertakan
|
|
12
|
+
|
|
13
|
+
- Deskripsi kerentanan
|
|
14
|
+
- Langkah-langkah reproduksi
|
|
15
|
+
- Versi yang terpengaruh
|
|
16
|
+
- Dampak potensial
|
|
17
|
+
- Saran perbaikan (kalo ada)
|
|
18
|
+
|
|
19
|
+
## Ruang Lingkup
|
|
20
|
+
|
|
21
|
+
- Package npm speedx-core
|
|
22
|
+
- CLI tool dep-exray
|
|
23
|
+
- GitHub Actions workflows
|
|
24
|
+
|
|
25
|
+
## Di Luar Ruang Lingkup
|
|
26
|
+
|
|
27
|
+
- Fungsi `xorCipher` di module crypto **SENG A JA BUKAN untuk keamanan**. Itu cuma XOR obfuscation sederhana buat masking data ringan. Jangan pake buat enkripsi data sensitif.
|
|
28
|
+
|
|
29
|
+
## Kebijakan Disclosure
|
|
30
|
+
|
|
31
|
+
Begitu kerentanan dikonfirmasi:
|
|
32
|
+
1. Kita bakal kerjain fix
|
|
33
|
+
2. Security advisory bakal dipublish di GitHub
|
|
34
|
+
3. Versi yang udh di-patch bakal dirilis ke npm
|
|
35
|
+
4. Kredit bakal dikasih ke pelapor (kalo mau)
|