superjs-core 0.4.3 → 0.5.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 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 superjs-core
92
+ - Hapus keyword "zero-dependency" yang misleading
93
+
94
+ ## [0.3.0] - 2026-06-27
95
+
96
+ ### Diubah
97
+ - `superjs-dep-exray` digabung ke `superjs-core` jadi module built-in
98
+ - Satu package: `npm install superjs-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
@@ -0,0 +1,55 @@
1
+ # Kontribusi ke superjs-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 superjs-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 CHANGED
@@ -17,8 +17,12 @@ Satu package buat semua kebutuhan JavaScript lo: utility functions, async helper
17
17
  | Fitur | Fungsi |
18
18
  |-------|--------|
19
19
  | **Validasi NIK** | `isNIK('3201010203940001')` — validasi 16 digit + tanggal lahir |
20
+ | **Parse NIK** | `parseNIK('320101...')` — extract gender, provinsi, tanggal lahir |
20
21
  | **Validasi NPWP** | `isNPWP('12.345.678.9-012.344')` — dengan checksum otomatis |
22
+ | **Validasi Plat Nomor** | `isPlatNomor('B 1234 CD')` — validasi plat kendaraan |
21
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 |
22
26
  | **Terbilang** | `terbilang(1500000)` → "satu juta lima ratus ribu" |
23
27
  | **Format Rupiah** | `formatRupiah(1500000)` → "Rp1.500.000" |
24
28
  | **Format Waktu** | `timeAgo(new Date(...))` → "5 detik yang lalu" |
@@ -42,7 +46,7 @@ Satu package buat semua kebutuhan JavaScript lo: utility functions, async helper
42
46
  | **crypto** | hash, base64, generateToken, generateOTP, constantTimeEqual |
43
47
  | **path** | join, resolve, basename, dirname, extname, normalize |
44
48
  | **color** | hexToRgb, rgbToHex, lighten, darken, contrastRatio, meetsWCAG |
45
- | **validation** | **isNIK**, **isNPWP**, **isPhone("id")**, isEmail, isURL |
49
+ | **validation** | **isNIK**, **parseNIK**, **isNPWP**, **isPlatNomor**, **isPhone**, **isKodepos**, **isNoRekening**, isEmail, isURL |
46
50
  | **error** | createError (typed + HTTP status), TypedError, MultiError |
47
51
  | **logger** | Logger class, child loggers, console/JSON/file transports |
48
52
  | **dep-exray** | scanProject, generateReport, analyzeUsage, CLI: `npx dep-exray .` |
@@ -118,7 +122,7 @@ git clone https://github.com/superdevids/superjs.git
118
122
  cd superjs/packages/core
119
123
  npm install
120
124
  npx tsup # Build
121
- npx vitest run # Test (810 tests)
125
+ npx vitest run # Test (828 tests)
122
126
  npx dep-exray . # Scan project sendiri
123
127
  ```
124
128
 
@@ -128,7 +132,7 @@ npx dep-exray . # Scan project sendiri
128
132
 
129
133
  | File Tes | Jumlah |
130
134
  |----------|--------|
131
- | 18 file | **810** passing ✅ |
135
+ | 19 file | **828** passing ✅ |
132
136
 
133
137
  ---
134
138
 
@@ -148,11 +152,11 @@ packages/core/
148
152
  │ ├── crypto/ # hash, generateToken, base64
149
153
  │ ├── path/ # join, resolve, basename
150
154
  │ ├── color/ # hexToRgb, lighten, darken, contrastRatio
151
- │ ├── validation/ # isNIK, isNPWP, isPhone, isEmail, isURL
155
+ │ ├── validation/ # isNIK, parseNIK, isNPWP, isPlatNomor, isPhone, isKodepos, isNoRekening, isEmail, isURL
152
156
  │ ├── error/ # createError, TypedError, MultiError
153
157
  │ ├── logger/ # Logger, transports
154
158
  │ └── dep-exray/ # Dependency scanner
155
- ├── tests/ # 810 tests
159
+ ├── tests/ # 828 tests
156
160
  ├── dist/ # Hasil build
157
161
  └── package.json
158
162
  ```
package/ROADMAP.md ADDED
@@ -0,0 +1,72 @@
1
+ # Roadmap SuperJS
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 superjs-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 superjs-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)
package/SUMMARY.md ADDED
@@ -0,0 +1,321 @@
1
+ # superjs-core — Ringkasan Fitur Lengkap
2
+
3
+ > **Versi:** 0.4.4 | **License:** MIT | **Zero runtime dependencies**
4
+
5
+ ```
6
+ npm install superjs-core
7
+ ```
8
+
9
+ ---
10
+
11
+ ## 1. CORE — Utility Functions
12
+
13
+ | Fungsi | Deskripsi |
14
+ |--------|-----------|
15
+ | `deepClone(value)` | Deep clone dengan circular reference, Date, RegExp, Map, Set support |
16
+ | `deepMerge(...objects)` | Deep merge multiple objects, nested overwrite |
17
+ | `deepEqual(a, b)` | Deep equality check — object, array, Date, Map, Set, RegExp |
18
+ | `pipe(initial, ...fns)` | Function composition left-to-right |
19
+ | `compose(...fns)` | Function composition right-to-left |
20
+ | `debounce(fn, wait, options?)` | Debounce dengan leading/trailing/maxWait |
21
+ | `throttle(fn, wait)` | Throttle execution |
22
+ | `memoize(fn, resolver?)` | Memoize dengan custom cache key |
23
+ | `retry(fn, options?)` | Retry dengan exponential backoff |
24
+ | `noop()` | No-operation function |
25
+ | `identity(value)` | Return input unchanged |
26
+ | `once(fn)` | Execute function sekali doang |
27
+
28
+ ---
29
+
30
+ ## 2. MATH
31
+
32
+ | Fungsi | Deskripsi |
33
+ |--------|-----------|
34
+ | `add(a, b)` | Safe addition (0.1+0.2=0.3) |
35
+ | `sub(a, b)` | Safe subtraction |
36
+ | `mul(a, b)` | Safe multiplication |
37
+ | `div(a, b)` | Safe division (throw kalo /0) |
38
+ | `round(value, precision?)` | Round dengan floating-point fix |
39
+ | `floor(value, precision?)` | Floor dengan precision |
40
+ | `ceil(value, precision?)` | Ceil dengan precision |
41
+ | `clamp(value, min, max)` | Clamp ke range |
42
+ | `sum(values)` | Sum of array |
43
+ | `average(values)` | Average (throw kalo kosong) |
44
+ | `randomInt(min, max)` | Random integer dalam range |
45
+ | `inRange(value, min, max)` | Cek apakah dalam range |
46
+ | `median(values)` | Median dari array |
47
+ | `stddev(values)` | Population standard deviation |
48
+ | `sampleStddev(values)` | Sample standard deviation |
49
+ | `percentile(values, p)` | Persentil (0-100) |
50
+ | `correlation(x, y)` | Pearson correlation |
51
+ | `formatCurrency(value, options?)` | Format mata uang locale-aware |
52
+
53
+ ---
54
+
55
+ ## 3. DATE & TIME
56
+
57
+ | Fungsi | Deskripsi |
58
+ |--------|-----------|
59
+ | `formatDate(date, format?)` | Format tanggal (YYYY-MM-DD, DD/MM/YYYY, dll) |
60
+ | `parseDate(input)` | Parse string/number/Date |
61
+ | `dateDiff(date1, date2)` | Selisih antar tanggal |
62
+ | `addDays(date, days)` | Tambah/kurang hari |
63
+ | `addMonths(date, months)` | Tambah/kurang bulan |
64
+ | `addYears(date, years)` | Tambah/kurang tahun |
65
+ | `startOfDay(date)` | Awal hari (00:00:00.000) |
66
+ | `endOfDay(date)` | Akhir hari (23:59:59.999) |
67
+ | `isWeekend(date)` | Sabtu atau Minggu |
68
+ | `isLeapYear(year)` | Cek tahun kabisat |
69
+ | `isBefore(date1, date2)`, `isAfter`, `isBetween` | Perbandingan tanggal |
70
+ | `isBusinessDay(date)` | Senin-Jumat |
71
+ | `addBusinessDays(date, days)` | Tambah hari kerja |
72
+ | `calculateAge(birthDate)` | Hitung umur dalam tahun |
73
+ | `timeAgo(date, options?)` | Waktu relatif ("5 detik yang lalu") |
74
+ | `timeRemaining(target, options?)` | Waktu menuju tanggal masa depan |
75
+ | `formatDuration(duration, options?)` | Format Duration object |
76
+ | `toTimezone(date, offsetHours)` | Konversi date ke timezone tertentu |
77
+ | `formatInTimezone(date, format, offset)` | Format tanggal di timezone tertentu |
78
+
79
+ ### Konstanta: `TIMEZONE_WIB` (7), `TIMEZONE_WITA` (8), `TIMEZONE_WIT` (9) 🇮🇩
80
+
81
+ ---
82
+
83
+ ## 4. COLLECTION — Array & Object Utilities
84
+
85
+ | Fungsi | Deskripsi |
86
+ |--------|-----------|
87
+ | `groupBy(items, keyFn)` | Grouping berdasarkan key |
88
+ | `keyBy(items, keyFn)` | Indexing berdasarkan key |
89
+ | `omit(obj, keys)` | Hapus keys tertentu |
90
+ | `pick(obj, keys)` | Ambil keys tertentu |
91
+ | `pluck(items, key)` | Extract property dari array |
92
+ | `shuffle(items)` | Fisher-Yates shuffle |
93
+ | `sample(items)` | Random element |
94
+ | `sampleSize(items, size)` | N random elements |
95
+ | `chunk(items, size)` | Potong array jadi chunk |
96
+ | `sortBy(items, ...criteria)` | Multi-criteria sort |
97
+ | `orderBy(items, key, dir?)` | Sort by key + direction |
98
+ | `uniqueBy(items, keyFn)` | Unique by key function |
99
+ | `flatten(items)` | Flatten satu level |
100
+ | `uniq(items)` | Hapus duplicate |
101
+ | `first(items)`, `last(items)` | Element pertama/terakhir |
102
+ | `isEmpty(value)` | Cek kosong |
103
+ | `topoSort(items)` | Topological sort (Kahn's algorithm) |
104
+ | `slidingWindows(items, size, step?)` | Overlapping windows |
105
+ | `tumblingWindows(items, size)` | Non-overlapping chunks |
106
+ | `deepGet(obj, path, default?)` | Akses nested object pake path string |
107
+ | `deepSet(obj, path, value)` | Set nested object pake path string |
108
+
109
+ ---
110
+
111
+ ## 5. STRING — Text Manipulation 🇮🇩
112
+
113
+ | Fungsi | Deskripsi |
114
+ |--------|-----------|
115
+ | `capitalize(str)` | Kapitalisasi huruf pertama |
116
+ | `camelCase(str)` | Konversi ke camelCase |
117
+ | `kebabCase(str)` | Konversi ke kebab-case |
118
+ | `snakeCase(str)` | Konversi ke snake_case |
119
+ | `pascalCase(str)` | Konversi ke PascalCase |
120
+ | `truncate(str, max, suffix?)` | Potong string dengan suffix |
121
+ | `template(str, data)` | Interpolasi string `{{key}}` |
122
+ | `uuid()` | RFC 4122 v4 UUID |
123
+ | `nanoid(size?, alphabet?)` | URL-safe random ID |
124
+ | `escapeHtml(str)` | Escape HTML entities |
125
+ | `unescapeHtml(str)` | Unescape HTML entities |
126
+ | `levenshtein(a, b)` | Levenshtein distance |
127
+ | `fuzzyMatch(str, query)` | Fuzzy string match |
128
+ | `maskString(str, options?)` | Masking data sensitif |
129
+ | `slugify(str)` | URL-friendly slug |
130
+ | `formatBytes(bytes, options?)` | Format ukuran file ("1 MB") |
131
+ | `randomString(length?)` | Random alphanumeric |
132
+ | `randomBoolean()` | Random true/false |
133
+ | `pluralize(count, singular)` | English pluralization |
134
+
135
+ ### 🇮🇩 Indonesian Locale
136
+
137
+ | Fungsi | Deskripsi |
138
+ |--------|-----------|
139
+ | `terbilang(value)` | **Angka ke kata** ("satu juta lima ratus ribu") |
140
+ | `formatRupiah(value, options?)` | **Format Rupiah** ("Rp1.500.000") |
141
+
142
+ ---
143
+
144
+ ## 6. ASYNC
145
+
146
+ | Fungsi | Deskripsi |
147
+ |--------|-----------|
148
+ | `sleep(ms)` | Delay eksekusi |
149
+ | `timeout(promise, ms)` | Reject kalo timeout |
150
+ | `raceWithTimeout(promise, ms)` | Race promise vs timeout |
151
+ | `allSettledMap(items, fn)` | Map dengan allSettled |
152
+ | `parallelMap(items, fn, concurrency?)` | Concurrent map dengan limit |
153
+ | `retryAsync(fn, options?)` | Retry dengan backoff |
154
+ | `pipeline(initial, ...fns)` | Async function composition |
155
+ | `deferred()` | Deferred promise |
156
+ | `Queue(options?)` | Priority task queue dengan concurrency |
157
+ | `Semaphore(concurrency)` | Semaphore buat resource control |
158
+ | `memoizeAsync(fn, options?)` | Async memoize dengan TTL + stale-while-revalidate |
159
+
160
+ ---
161
+
162
+ ## 7. IO
163
+
164
+ | Fungsi | Deskripsi |
165
+ |--------|-----------|
166
+ | `parseCsv(input, options?)` | Parse CSV string |
167
+ | `stringifyCsv(data, options?)` | Convert records ke CSV |
168
+ | `safeJsonParse(input, default?)` | Safe JSON parse |
169
+ | `env(name, default?)` | Baca environment variable |
170
+ | `envInt(name, default?)` | Baca env var sebagai integer |
171
+ | `envBool(name, default?)` | Baca env var sebagai boolean |
172
+
173
+ ---
174
+
175
+ ## 8. TYPE — Type Guards
176
+
177
+ | Fungsi | Deskripsi |
178
+ |--------|-----------|
179
+ | `isString`, `isNumber`, `isBoolean`, `isObject`, `isArray`, `isFunction` | Type checks |
180
+ | `isDate`, `isRegExp`, `isMap`, `isSet`, `isPromise` | Instance checks |
181
+ | `isNull`, `isUndefined`, `isNil` | Nullish checks |
182
+ | `isEmpty(value)` | Empty/blank check |
183
+ | `assertDefined(value, msg?)` | Runtime assertion |
184
+ | `assertType(value, guard, msg?)` | Type assertion |
185
+ | `ensureArray(value)` / `castArray(value)` | Wrap in array |
186
+ | `getType(value)` | String type name |
187
+
188
+ ---
189
+
190
+ ## 9. CRYPTO
191
+
192
+ | Fungsi | Deskripsi |
193
+ |--------|-----------|
194
+ | `hash(str)` | djb2 hash (32-bit) |
195
+ | `simpleHash(str)` | Simple hex hash |
196
+ | `randomHex(size?)` | Random hex string |
197
+ | `base64Encode(str)` | Base64 encode (UTF-8 safe) |
198
+ | `base64Decode(str)` | Base64 decode |
199
+ | `generateToken(bytes?)` | Crypto-random hex token |
200
+ | `generateOTP(length?)` | Numeric OTP |
201
+ | `xorCipher(str, key)` | ⚠️ XOR obfuscation (BUKAN encryption) |
202
+ | `checksum(input)` | CRC-like checksum |
203
+ | `constantTimeEqual(a, b)` | Timing-safe string comparison |
204
+
205
+ ---
206
+
207
+ ## 10. PATH
208
+
209
+ | Fungsi | Deskripsi |
210
+ |--------|-----------|
211
+ | `join(...segments)` | Gabung path segments |
212
+ | `resolve(...segments)` | Resolve ke absolute path |
213
+ | `basename(p, ext?)` | Ambil filename |
214
+ | `dirname(p)` | Ambil directory |
215
+ | `extname(p)` | Ambil extension |
216
+ | `normalize(p)` | Normalize path |
217
+ | `isAbsolute(p)` | Cek absolute path |
218
+ | `relative(from, to)` | Relative path |
219
+ | `parse(p)` | Parse path jadi components |
220
+ | `format(parsed)` | Format parsed path |
221
+
222
+ ---
223
+
224
+ ## 11. VALIDATION — 🇮🇩 Khusus Indonesia
225
+
226
+ | Fungsi | Deskripsi |
227
+ |--------|-----------|
228
+ | `isNIK(value)` | **Validasi NIK** 16 digit + tanggal lahir |
229
+ | `parseNIK(value)` | **Extract data dari NIK** — gender, provinsi, tanggal lahir |
230
+ | `isNPWP(value)` | **Validasi NPWP** + checksum |
231
+ | `isPlatNomor(value)` | **Validasi plat kendaraan** RI (B 1234 CD) |
232
+ | `isPhone(value, country?)` | **Validasi nomor HP Indonesia** |
233
+ | `isKodepos(value)` | **Validasi kode pos** 5 digit |
234
+ | `isNoRekening(value)` | **Validasi nomor rekening** bank (8-16 digit) |
235
+ | `isEmail(value)` | Validasi email RFC-compliant |
236
+ | `isURL(value)` | Validasi URL (http/https) |
237
+
238
+ ---
239
+
240
+ ## 12. ERROR — Typed Errors
241
+
242
+ | Fungsi | Deskripsi |
243
+ |--------|-----------|
244
+ | `createError(code, message, options?)` | Bikin typed error dengan HTTP status |
245
+ | `isTypedError(error)` | Type guard |
246
+ | `TypedError` | Class dengan code + status + details + toJSON |
247
+ | `MultiError` | Kumpulin multiple errors |
248
+ | `collectErrors(fn)` | Jalanin function, kumpulin error yang ke-throw |
249
+
250
+ ### Error Codes: `BAD_REQUEST` (400), `UNAUTHORIZED` (401), `FORBIDDEN` (403), `NOT_FOUND` (404), `CONFLICT` (409), `VALIDATION_ERROR` (422), `TOO_MANY` (429), `INTERNAL` (500), `BAD_GATEWAY` (502), `UNAVAILABLE` (503)
251
+
252
+ ---
253
+
254
+ ## 13. LOGGER — Structured Logging
255
+
256
+ | Fungsi | Deskripsi |
257
+ |--------|-----------|
258
+ | `Logger(options?)` | Structured logger dengan level |
259
+ | `logger` | Default singleton (info level) |
260
+ | `createConsoleTransport(options?)` | Colored console output |
261
+ | `createJsonTransport(options?)` | JSON-line output |
262
+ | `createFileTransport(filename, options?)` | File appender |
263
+ | `createBufferedTransport(transport, options?)` | Batched transport |
264
+
265
+ ### Log Levels: `debug`, `info`, `warn`, `error`
266
+
267
+ ---
268
+
269
+ ## 14. COLOR — Color Utilities
270
+
271
+ | Fungsi | Deskripsi |
272
+ |--------|-----------|
273
+ | `hexToRgb(hex)` | Convert hex ke RGB object |
274
+ | `rgbToHex(r, g, b)` | Convert RGB ke hex string |
275
+ | `lighten(hex, percent)` | Terangin warna (0-100%) |
276
+ | `darken(hex, percent)` | Gelapin warna (0-100%) |
277
+ | `contrastRatio(hex1, hex2)` | WCAG contrast ratio (1-21) |
278
+ | `meetsWCAG(hex1, hex2, level?)` | Cek WCAG compliance (AA/AAA) |
279
+
280
+ ---
281
+
282
+ ## 15. DEP-EXRAY — Dependency Health Scanner
283
+
284
+ | Fungsi | Deskripsi |
285
+ |--------|-----------|
286
+ | `scanProject(config)` | Scan project buat bloat + security issues |
287
+ | `generateReport(result, json?)` | Generate scan report |
288
+ | `analyzeUsage(projectPath, packageName)` | Deteksi pemakaian dependency |
289
+ | `KNOWN_MAPPINGS` | 11 known replacement mappings |
290
+ | `KNOWN_CVES` | CVE database untuk known packages |
291
+
292
+ **CLI:** `npx dep-exray .`
293
+
294
+ ---
295
+
296
+ ## Statistik Test
297
+
298
+ | Module | Test Files | Tests |
299
+ |--------|-----------|-------|
300
+ | Semua module | 19 | **828** ✅ |
301
+
302
+ ---
303
+
304
+ ## Referensi Cepat
305
+
306
+ ```bash
307
+ npm install superjs-core
308
+
309
+ # Import semua module
310
+ import { deepClone, deepEqual, pipe } from 'superjs-core'
311
+ import { formatDate, timeAgo, TIMEZONE_WIB } from 'superjs-core/date'
312
+ import { groupBy, topoSort, deepGet } from 'superjs-core/collection'
313
+ import { terbilang, formatRupiah, formatBytes } from 'superjs-core/string'
314
+ import { Queue, Semaphore } from 'superjs-core/async'
315
+ import { isNIK, isNPWP, isPhone } from 'superjs-core/validation'
316
+ import { createError, MultiError } from 'superjs-core/error'
317
+ import { Logger } from 'superjs-core/logger'
318
+ import { hexToRgb, lighten, contrastRatio } from 'superjs-core/color'
319
+ import { median, stddev, formatCurrency } from 'superjs-core/math'
320
+ import { scanProject } from 'superjs-core/dep-exray'
321
+ ```