superjs-core 0.4.3 → 0.4.4

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,91 @@
1
+ # Changelog
2
+
3
+ ## [0.4.0] - 2026-06-28
4
+
5
+ ### Ditambahkan
6
+ - **color module** — `hexToRgb()`, `rgbToHex()`, `lighten()`, `darken()`, `contrastRatio()`, `meetsWCAG()`
7
+ - **core** — `deepEqual()` (deep equality), `pipe()`, `compose()` (function composition)
8
+ - **string** — `formatBytes()`, `randomString()`, `randomBoolean()`, `pluralize()`
9
+ - **collection** — `deepGet()`, `deepSet()` (nested object path access)
10
+ - 810 total tests (18 test files)
11
+
12
+ ### Diubah
13
+ - Semua dokumentasi pake Bahasa Indonesia
14
+
15
+ ## [0.3.9] - 2026-06-28
16
+
17
+ ### Diubah
18
+ - README pake Bahasa Inggris (dulu Indonesia)
19
+ - Description npm diupdate
20
+
21
+ ## [0.3.6] - 2026-06-28
22
+
23
+ ### Diubah
24
+ - 810 total tests (dari 484) — nambah brutal audit suite 273 edge-case tests
25
+ - SUMMARY.md dibuat — dokumentasi fitur lengkap semua module
26
+
27
+ ### Dibenerin
28
+ - 6 bug ditemukan pas brutal audit
29
+ - Semua prototype pollution, ReDoS, crypto tests terverifikasi
30
+
31
+ ## [0.3.5] - 2026-06-28
32
+
33
+ ### Ditambahkan (Ekspansi P1)
34
+ - **async**: Queue (priority task queue), Semaphore, memoizeAsync (stale-while-revalidate)
35
+ - **math**: median, stddev, sampleStddev, percentile, correlation, formatCurrency
36
+ - **string**: levenshtein, fuzzyMatch, maskString (PDPA compliance), terbilang (angka→kata), formatRupiah
37
+ - **collection**: topoSort (Kahn's algorithm), slidingWindows, tumblingWindows
38
+ - **date**: timeAgo (id/en), timeRemaining, Duration, formatDuration, toTimezone, formatInTimezone, WIB/WITA/WIT constants
39
+
40
+ ## [0.3.4] - 2026-06-28
41
+
42
+ ### Ditambahkan (Modul P0)
43
+ - **validation**: isNIK, isNPWP, isPhone, isEmail, isURL — validasi khusus Indonesia
44
+ - **error**: createError, TypedError (10 codes + HTTP status), MultiError, collectErrors
45
+ - **logger**: Logger class, child loggers, console/JSON/file transports, buffered transport
46
+ - 16 modules total, 484 tests passing
47
+
48
+ ## [0.3.3] - 2026-06-28
49
+
50
+ ### Dibenerin
51
+ - `round(1.005, 2)` floating-point bug
52
+ - `parseDate('29/02/2023')` gak throw buat invalid leap year
53
+ - Nambah `sideEffects: false` buat tree-shaking optimal
54
+
55
+ ## [0.3.2] - 2026-06-28
56
+
57
+ ### Ditambahkan
58
+ - Biome linter + formatter config
59
+ - CI workflow dengan matrix testing (Node 18, 20, 22)
60
+ - SECURITY.md buat vulnerability disclosure
61
+ - CHANGELOG.md
62
+
63
+ ### Dibenerin
64
+ - Cross-platform `clean` script
65
+ - GitHub Actions: dep-exray-scan pake superjs-core
66
+ - Hapus keyword "zero-dependency" yang misleading
67
+
68
+ ## [0.3.0] - 2026-06-27
69
+
70
+ ### Diubah
71
+ - `superjs-dep-exray` digabung ke `superjs-core` jadi module built-in
72
+ - Satu package: `npm install superjs-core` dapet semua
73
+ - 7 npm packages di-unpublish/deprecate
74
+
75
+ ### Ditambahkan
76
+ - `dep-exray` module: scanProject, analyzeUsage, generateReport
77
+ - CLI: `npx dep-exray .`
78
+
79
+ ## [0.2.0] - 2026-06-27
80
+
81
+ ### Ditambahkan
82
+ - crypto module: hash, randomHex, base64, generateToken, generateOTP
83
+ - path module: join, resolve, basename, dirname, extname
84
+
85
+ ## [0.1.0] - 2026-06-27
86
+
87
+ ### Ditambahkan
88
+ - Initial release
89
+ - core, math, date, collection, string, async, io, type modules
90
+ - 100+ utility functions
91
+ - 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` (810 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 (810 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` — 810 tests pass
42
+ - [ ] `npm login` — udah login
43
+ - [ ] Changelog udah diupdate
44
+ - [ ] README udah sesuai
45
+ - [ ] Git commit — semua perubahan ter-commit
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()`, `isNPWP()`, `isPhone("id")`, `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,317 @@
1
+ # superjs-core — Ringkasan Fitur Lengkap
2
+
3
+ > **Versi:** 0.4.0 | **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
+ | `isNPWP(value)` | **Validasi NPWP** + checksum |
230
+ | `isPhone(value, country?)` | **Validasi nomor HP Indonesia** |
231
+ | `isEmail(value)` | Validasi email RFC-compliant |
232
+ | `isURL(value)` | Validasi URL (http/https) |
233
+
234
+ ---
235
+
236
+ ## 12. ERROR — Typed Errors
237
+
238
+ | Fungsi | Deskripsi |
239
+ |--------|-----------|
240
+ | `createError(code, message, options?)` | Bikin typed error dengan HTTP status |
241
+ | `isTypedError(error)` | Type guard |
242
+ | `TypedError` | Class dengan code + status + details + toJSON |
243
+ | `MultiError` | Kumpulin multiple errors |
244
+ | `collectErrors(fn)` | Jalanin function, kumpulin error yang ke-throw |
245
+
246
+ ### 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)
247
+
248
+ ---
249
+
250
+ ## 13. LOGGER — Structured Logging
251
+
252
+ | Fungsi | Deskripsi |
253
+ |--------|-----------|
254
+ | `Logger(options?)` | Structured logger dengan level |
255
+ | `logger` | Default singleton (info level) |
256
+ | `createConsoleTransport(options?)` | Colored console output |
257
+ | `createJsonTransport(options?)` | JSON-line output |
258
+ | `createFileTransport(filename, options?)` | File appender |
259
+ | `createBufferedTransport(transport, options?)` | Batched transport |
260
+
261
+ ### Log Levels: `debug`, `info`, `warn`, `error`
262
+
263
+ ---
264
+
265
+ ## 14. COLOR — Color Utilities
266
+
267
+ | Fungsi | Deskripsi |
268
+ |--------|-----------|
269
+ | `hexToRgb(hex)` | Convert hex ke RGB object |
270
+ | `rgbToHex(r, g, b)` | Convert RGB ke hex string |
271
+ | `lighten(hex, percent)` | Terangin warna (0-100%) |
272
+ | `darken(hex, percent)` | Gelapin warna (0-100%) |
273
+ | `contrastRatio(hex1, hex2)` | WCAG contrast ratio (1-21) |
274
+ | `meetsWCAG(hex1, hex2, level?)` | Cek WCAG compliance (AA/AAA) |
275
+
276
+ ---
277
+
278
+ ## 15. DEP-EXRAY — Dependency Health Scanner
279
+
280
+ | Fungsi | Deskripsi |
281
+ |--------|-----------|
282
+ | `scanProject(config)` | Scan project buat bloat + security issues |
283
+ | `generateReport(result, json?)` | Generate scan report |
284
+ | `analyzeUsage(projectPath, packageName)` | Deteksi pemakaian dependency |
285
+ | `KNOWN_MAPPINGS` | 11 known replacement mappings |
286
+ | `KNOWN_CVES` | CVE database untuk known packages |
287
+
288
+ **CLI:** `npx dep-exray .`
289
+
290
+ ---
291
+
292
+ ## Statistik Test
293
+
294
+ | Module | Test Files | Tests |
295
+ |--------|-----------|-------|
296
+ | Semua module | 18 | **810** ✅ |
297
+
298
+ ---
299
+
300
+ ## Referensi Cepat
301
+
302
+ ```bash
303
+ npm install superjs-core
304
+
305
+ # Import semua module
306
+ import { deepClone, deepEqual, pipe } from 'superjs-core'
307
+ import { formatDate, timeAgo, TIMEZONE_WIB } from 'superjs-core/date'
308
+ import { groupBy, topoSort, deepGet } from 'superjs-core/collection'
309
+ import { terbilang, formatRupiah, formatBytes } from 'superjs-core/string'
310
+ import { Queue, Semaphore } from 'superjs-core/async'
311
+ import { isNIK, isNPWP, isPhone } from 'superjs-core/validation'
312
+ import { createError, MultiError } from 'superjs-core/error'
313
+ import { Logger } from 'superjs-core/logger'
314
+ import { hexToRgb, lighten, contrastRatio } from 'superjs-core/color'
315
+ import { median, stddev, formatCurrency } from 'superjs-core/math'
316
+ import { scanProject } from 'superjs-core/dep-exray'
317
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superjs-core",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "JavaScript toolkit all-in-one buat developer Indonesia: validasi NIK/NPWP/Phone, terbilang, formatRupiah, timeAgo (WIB/WITA/WIT), deepClone, logger, dep scanner. 100+ fungsi, zero dep runtime.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -105,7 +105,8 @@
105
105
  },
106
106
  "sideEffects": false,
107
107
  "files": [
108
- "dist"
108
+ "dist",
109
+ "*.md"
109
110
  ],
110
111
  "scripts": {
111
112
  "build": "tsup",