@rtorcato/js-common 1.8.1 → 2.0.1
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 +24 -0
- package/README.md +77 -62
- package/dist/abortController/index.d.ts +29 -0
- package/dist/abortController/index.d.ts.map +1 -0
- package/dist/arrays/index.d.ts +134 -0
- package/dist/arrays/index.d.ts.map +1 -0
- package/dist/arrays/index.js +1 -1
- package/dist/boolean/index.d.ts +41 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +1 -1
- package/dist/colors/index.d.ts +63 -0
- package/dist/colors/index.d.ts.map +1 -0
- package/dist/console/index.d.ts +16 -0
- package/dist/console/index.d.ts.map +1 -0
- package/dist/crypto/index.d.ts +34 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/currency/currencies.d.ts +16 -0
- package/dist/currency/currencies.d.ts.map +1 -0
- package/dist/currency/index.d.ts +170 -0
- package/dist/currency/index.d.ts.map +1 -0
- package/dist/date/index.d.ts +44 -0
- package/dist/date/index.d.ts.map +1 -0
- package/dist/datetime/index.d.ts +52 -0
- package/dist/datetime/index.d.ts.map +1 -0
- package/dist/emails/banned/index.d.ts +9 -0
- package/dist/emails/banned/index.d.ts.map +1 -0
- package/dist/emails/index.d.ts +26 -0
- package/dist/emails/index.d.ts.map +1 -0
- package/dist/env/index.d.ts +63 -0
- package/dist/env/index.d.ts.map +1 -0
- package/dist/errors/index.d.ts +39 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +1 -1
- package/dist/events/index.d.ts +35 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/fetch/index.d.ts +38 -0
- package/dist/fetch/index.d.ts.map +1 -0
- package/dist/file/index.d.ts +32 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/formatting/index.d.ts +40 -0
- package/dist/formatting/index.d.ts.map +1 -0
- package/dist/functions/index.d.ts +33 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/geometry/index.d.ts +58 -0
- package/dist/geometry/index.d.ts.map +1 -0
- package/dist/html/index.d.ts +31 -0
- package/dist/html/index.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +37 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/interval/index.d.ts +13 -0
- package/dist/interval/index.d.ts.map +1 -0
- package/dist/json/index.d.ts +28 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/logger.d.ts +3 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logging/index.d.ts +29 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +1 -1
- package/dist/maps/index.d.ts +32 -0
- package/dist/maps/index.d.ts.map +1 -0
- package/dist/math/index.d.ts +37 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +1 -1
- package/dist/mime-types/db.d.ts +4605 -0
- package/dist/mime-types/db.d.ts.map +1 -0
- package/dist/mime-types/index.d.ts +25 -0
- package/dist/mime-types/index.d.ts.map +1 -0
- package/dist/node/index.d.ts +52 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/numbers/index.d.ts +82 -0
- package/dist/numbers/index.d.ts.map +1 -0
- package/dist/objects/index.d.ts +35 -0
- package/dist/objects/index.d.ts.map +1 -0
- package/dist/os/index.d.ts +26 -0
- package/dist/os/index.d.ts.map +1 -0
- package/dist/process/index.d.ts +31 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/promises/index.d.ts +39 -0
- package/dist/promises/index.d.ts.map +1 -0
- package/dist/random/index.d.ts +33 -0
- package/dist/random/index.d.ts.map +1 -0
- package/dist/regex/index.d.ts +36 -0
- package/dist/regex/index.d.ts.map +1 -0
- package/dist/security/index.d.ts +14 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/sets/index.d.ts +48 -0
- package/dist/sets/index.d.ts.map +1 -0
- package/dist/sleep/index.d.ts +27 -0
- package/dist/sleep/index.d.ts.map +1 -0
- package/dist/strings/index.d.ts +296 -0
- package/dist/strings/index.d.ts.map +1 -0
- package/dist/system/index.d.ts +36 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/time/index.d.ts +36 -0
- package/dist/time/index.d.ts.map +1 -0
- package/dist/try/attempt.d.ts +8 -0
- package/dist/try/attempt.d.ts.map +1 -0
- package/dist/try/index.d.ts +2 -0
- package/dist/try/index.d.ts.map +1 -0
- package/dist/try/trycatch.d.ts +12 -0
- package/dist/try/trycatch.d.ts.map +1 -0
- package/dist/types/common/index.d.ts +9 -0
- package/dist/types/env.d.ts +5 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/url/index.d.ts +40 -0
- package/dist/url/index.d.ts.map +1 -0
- package/dist/uuid/index.d.ts +99 -0
- package/dist/uuid/index.d.ts.map +1 -0
- package/dist/validation/index.d.ts +49 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +1 -1
- package/package.json +3 -16
- package/dist/chunks/chunk-DCFILRIS.js +0 -1
- package/dist/math/math.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## [2.0.1](https://github.com/rtorcato/js-common/compare/v2.0.0...v2.0.1) (2026-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **build:** ship .d.ts files in published tarball ([946cd8a](https://github.com/rtorcato/js-common/commit/946cd8a27ba52923cbcf857d996f52590d9008d5))
|
|
7
|
+
|
|
8
|
+
# [2.0.0](https://github.com/rtorcato/js-common/compare/v1.8.1...v2.0.0) (2026-06-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* refactor!: maintenance sweep + rename errors.tryCatch ([#47](https://github.com/rtorcato/js-common/issues/47)) ([9bd28a6](https://github.com/rtorcato/js-common/commit/9bd28a68b7566806169812ffed5ccb649d30e6c3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ci:** env-var commit message in check-skip ([#48](https://github.com/rtorcato/js-common/issues/48)) ([1037b0c](https://github.com/rtorcato/js-common/commit/1037b0c31c377bbc80eda57cbe3e411579437685)), closes [#47](https://github.com/rtorcato/js-common/issues/47)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### BREAKING CHANGES
|
|
20
|
+
|
|
21
|
+
* `tryCatch` from `@rtorcato/js-common/errors` is
|
|
22
|
+
renamed to `tryWithFallback`. For Result-pattern error handling,
|
|
23
|
+
import `tryCatch` from `@rtorcato/js-common/try` instead.
|
|
24
|
+
|
|
1
25
|
## [1.8.1](https://github.com/rtorcato/js-common/compare/v1.8.0...v1.8.1) (2026-05-29)
|
|
2
26
|
|
|
3
27
|
|
package/README.md
CHANGED
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://nodejs.org/)
|
|
9
|
+
[](https://codecov.io/gh/rtorcato/js-common)
|
|
9
10
|
[](https://rtorcato.github.io/js-common/)
|
|
10
11
|
|
|
11
12
|
A comprehensive set of common JavaScript and TypeScript utilities for Node.js projects.
|
|
12
13
|
|
|
13
14
|
📘 **Documentation:** <https://rtorcato.github.io/js-common/>
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## Features
|
|
16
17
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- 🧪 **Well tested** - Comprehensive test coverage
|
|
18
|
+
- **Tree-shakeable** — import only what you need via subpath exports
|
|
19
|
+
- **TypeScript** — full type definitions, JSDoc on every public API
|
|
20
|
+
- **CLI included** — optional binary for use in scripts and terminals
|
|
21
|
+
- **Modular** — one module per concern, 46 subpaths
|
|
22
|
+
- **Minimal runtime deps** — only `date-fns`, `date-fns-tz`, `luxon`, `pino`, `uuid`, `short-uuid`, `zod`. CLI packages (`chalk`, `commander`, `figlet`, …) are `optionalDependencies` and only needed for the CLI.
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -27,6 +27,30 @@ A comprehensive set of common JavaScript and TypeScript utilities for Node.js pr
|
|
|
27
27
|
npm install @rtorcato/js-common
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Migrating from 1.x to 2.x
|
|
31
|
+
|
|
32
|
+
The only breaking change in 2.0 is a rename in the `errors` module:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// 1.x — swallow errors and fall back to a default value
|
|
36
|
+
import { tryCatch } from '@rtorcato/js-common/errors'
|
|
37
|
+
const data = await tryCatch(() => fetchData(), [])
|
|
38
|
+
|
|
39
|
+
// 2.x — same function, renamed for clarity
|
|
40
|
+
import { tryWithFallback } from '@rtorcato/js-common/errors'
|
|
41
|
+
const data = await tryWithFallback(() => fetchData(), [])
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The name `tryCatch` is now reserved for the Result-pattern helper in `@rtorcato/js-common/try`, which returns `{ data, error }` instead of swallowing:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { tryCatch } from '@rtorcato/js-common/try'
|
|
48
|
+
const { data, error } = await tryCatch(() => fetchData())
|
|
49
|
+
if (error) { /* handle */ }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Prefer the Result-style `tryCatch` for new code; reserve `tryWithFallback` for cases where the fallback is genuinely safe.
|
|
53
|
+
|
|
30
54
|
## CLI Usage
|
|
31
55
|
|
|
32
56
|
This package includes a command-line interface for many utilities:
|
|
@@ -50,7 +74,7 @@ See [CLI.md](./CLI.md) for complete CLI documentation.
|
|
|
50
74
|
## Library Usage
|
|
51
75
|
|
|
52
76
|
```typescript
|
|
53
|
-
//
|
|
77
|
+
// Import specific modules (recommended for tree-shaking)
|
|
54
78
|
import { formatDate, today, daysBetween } from '@rtorcato/js-common/date'
|
|
55
79
|
import { validateEmail, isValidEmail } from '@rtorcato/js-common/emails'
|
|
56
80
|
import { generateUUID, isValidUUID } from '@rtorcato/js-common/uuid'
|
|
@@ -58,7 +82,7 @@ import { sum, average, roundTo } from '@rtorcato/js-common/numbers'
|
|
|
58
82
|
import { capitalize, toTitleCase } from '@rtorcato/js-common/formatting'
|
|
59
83
|
|
|
60
84
|
// Example usage
|
|
61
|
-
console.log(today()) // "
|
|
85
|
+
console.log(today()) // "2026-05-29"
|
|
62
86
|
console.log(sum([1, 2, 3, 4, 5])) // 15
|
|
63
87
|
console.log(capitalize('hello world')) // "Hello world"
|
|
64
88
|
console.log(generateUUID()) // "f47ac10b-58cc-4372-a567-0e02b2c3d479"
|
|
@@ -68,102 +92,93 @@ console.log(generateUUID()) // "f47ac10b-58cc-4372-a567-0e02b2c3d479"
|
|
|
68
92
|
|
|
69
93
|
Each module is shipped as its own subpath export so bundlers only include what you import. Individual modules range from ~100 bytes (e.g. `sleep`) to ~2 KB (e.g. `currency`) when minified. Measure against your own bundle with [bundlejs.com](https://bundlejs.com/?q=@rtorcato/js-common/numbers).
|
|
70
94
|
|
|
71
|
-
### 🎯 **TypeScript Support**
|
|
72
|
-
|
|
73
|
-
This package is built with TypeScript and includes complete type definitions out of the box:
|
|
74
|
-
|
|
75
|
-
- ✅ **Full type safety** - All functions have accurate TypeScript types
|
|
76
|
-
- ✅ **Generic support** - Functions like `unique<T>()` preserve your data types
|
|
77
|
-
- ✅ **JSDoc integration** - Rich documentation in your IDE
|
|
78
|
-
- ✅ **Tree-shakable** - Import only what you need with perfect type inference
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
// TypeScript automatically infers types
|
|
82
|
-
const numbers = [1, 2, 3, 4, 5]
|
|
83
|
-
const result: number = sum(numbers) // ✅ Type: number
|
|
84
|
-
|
|
85
|
-
const users = [{ name: 'John' }, { name: 'Jane' }]
|
|
86
|
-
const uniqueUsers = unique(users) // ✅ Type: { name: string }[]
|
|
87
|
-
|
|
88
|
-
// IDE shows full documentation and type hints
|
|
89
|
-
import { today } from '@rtorcato/js-common/date'
|
|
90
|
-
// ^ JSDoc: Returns today's date as YYYY-MM-DD string
|
|
91
|
-
```
|
|
92
|
-
|
|
93
95
|
## Available Modules
|
|
94
96
|
|
|
95
|
-
###
|
|
97
|
+
### Date & Time
|
|
96
98
|
```typescript
|
|
97
99
|
import { today, formatDate, daysBetween, isLeapYear } from '@rtorcato/js-common/date'
|
|
98
100
|
import { nowIso, formatDateTimeLocal, unixTimestamp } from '@rtorcato/js-common/datetime'
|
|
99
101
|
import { nowTime, parseTime, secondsBetween } from '@rtorcato/js-common/time'
|
|
102
|
+
import { runInterval, clearIntervalById } from '@rtorcato/js-common/interval'
|
|
100
103
|
```
|
|
101
104
|
|
|
102
|
-
###
|
|
105
|
+
### Numbers & Math
|
|
103
106
|
```typescript
|
|
104
107
|
import { sum, average, roundTo, clamp, getRandomInt } from '@rtorcato/js-common/numbers'
|
|
105
108
|
import { add, subtract, multiply, divide } from '@rtorcato/js-common/math'
|
|
109
|
+
import { randomInt, randomFloat, randomBool, randomElement } from '@rtorcato/js-common/random'
|
|
106
110
|
```
|
|
107
111
|
|
|
108
|
-
###
|
|
112
|
+
### Text & Strings
|
|
109
113
|
```typescript
|
|
110
114
|
import { capitalize, toTitleCase, padZero } from '@rtorcato/js-common/formatting'
|
|
111
115
|
import { slugify, truncate, removeEmojis } from '@rtorcato/js-common/strings'
|
|
116
|
+
import { escapeHtml, unescapeHtml, stripHtmlTags } from '@rtorcato/js-common/html'
|
|
117
|
+
import { escapeRegExp, matchAll, replaceAllRegex } from '@rtorcato/js-common/regex'
|
|
118
|
+
import { detectLanguage, formatNumber, t, pluralize } from '@rtorcato/js-common/i18n'
|
|
112
119
|
```
|
|
113
120
|
|
|
114
|
-
###
|
|
121
|
+
### Security & Validation
|
|
115
122
|
```typescript
|
|
116
123
|
import { isStrongPassword, generateSecureToken } from '@rtorcato/js-common/security'
|
|
117
124
|
import { isValidEmail, validateEmail } from '@rtorcato/js-common/emails'
|
|
118
125
|
import { isValidUrl } from '@rtorcato/js-common/url'
|
|
119
126
|
import { isString, isNumber, isArray, isObject } from '@rtorcato/js-common/validation'
|
|
127
|
+
import { toBoolean, isBoolean, xor } from '@rtorcato/js-common/boolean'
|
|
120
128
|
```
|
|
121
129
|
|
|
122
|
-
###
|
|
130
|
+
### Data Structures
|
|
123
131
|
```typescript
|
|
124
132
|
import { flatten, unique, chunk, groupBy } from '@rtorcato/js-common/arrays'
|
|
125
133
|
import { deepMerge, pick, omit, deepClone } from '@rtorcato/js-common/objects'
|
|
126
134
|
import { safeJsonParse, safeJsonStringify } from '@rtorcato/js-common/json'
|
|
135
|
+
import { invertMap, mapValues, objectToMap, mapToObject } from '@rtorcato/js-common/maps'
|
|
136
|
+
import { union, intersection, difference, isSubset } from '@rtorcato/js-common/sets'
|
|
127
137
|
```
|
|
128
138
|
|
|
129
|
-
###
|
|
139
|
+
### Async & Control Flow
|
|
130
140
|
```typescript
|
|
131
141
|
import { delay, timeout, retry } from '@rtorcato/js-common/promises'
|
|
132
142
|
import { debounce, throttle, once } from '@rtorcato/js-common/functions'
|
|
133
143
|
import { sleep } from '@rtorcato/js-common/sleep'
|
|
144
|
+
import { tryCatch } from '@rtorcato/js-common/try'
|
|
145
|
+
import { createAbortController, withAbort, abortAfter } from '@rtorcato/js-common/abortController'
|
|
146
|
+
import { createCustomError, getErrorMessage, assert } from '@rtorcato/js-common/errors'
|
|
134
147
|
```
|
|
135
148
|
|
|
136
|
-
###
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
### System & Process
|
|
150
|
+
```typescript
|
|
151
|
+
import { getENV, isDev, isProd, getNodeEnv, checkEnv } from '@rtorcato/js-common/env'
|
|
152
|
+
import { getOsPlatform, getOsArch, getHomeDir } from '@rtorcato/js-common/os'
|
|
153
|
+
import { getNodeMajorVersion, isNode, requireOptional } from '@rtorcato/js-common/node'
|
|
154
|
+
import { getProcessId, getCwd, exitProcess, isCI } from '@rtorcato/js-common/process'
|
|
155
|
+
import { isMacOs, isWindows, isLinux, getPlatform } from '@rtorcato/js-common/system'
|
|
156
|
+
import { disableConsole, clearConsole } from '@rtorcato/js-common/console'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Logging
|
|
160
|
+
```typescript
|
|
161
|
+
import { logger } from '@rtorcato/js-common/logger' // pino-based
|
|
162
|
+
import { info, warn, error, captureConsole } from '@rtorcato/js-common/logging'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Other
|
|
166
|
+
- `colors` — color manipulation and conversion
|
|
167
|
+
- `crypto` — cryptographic helpers
|
|
168
|
+
- `currency` — currency formatting and conversion
|
|
169
|
+
- `events` — event emitter utilities
|
|
170
|
+
- `fetch` — HTTP request helpers
|
|
171
|
+
- `file` — file system helpers
|
|
172
|
+
- `geometry` — 2D geometry calculations
|
|
173
|
+
- `mime-types` — MIME-type lookup
|
|
174
|
+
- `uuid` — UUID generation and validation
|
|
175
|
+
- `types` — shared TypeScript type definitions (types-only export)
|
|
147
176
|
|
|
148
177
|
## Requirements
|
|
149
178
|
|
|
150
179
|
- **Node.js** >= 22.0.0 (enforced via the `engines` field)
|
|
151
180
|
- **TypeScript** >= 5.0.0 (for TypeScript projects)
|
|
152
181
|
|
|
153
|
-
## Why This Library?
|
|
154
|
-
|
|
155
|
-
### 🎯 **Focused & Lightweight**
|
|
156
|
-
Unlike larger utility libraries, js-common is designed for modern applications:
|
|
157
|
-
- **Tiny bundle size** - Won't bloat your application
|
|
158
|
-
- **Tree-shakeable** - Only import what you use
|
|
159
|
-
- **CLI included** - Use utilities in scripts and terminal
|
|
160
|
-
|
|
161
|
-
### 🛠️ **Modern Development**
|
|
162
|
-
- Built with **TypeScript** for excellent DX
|
|
163
|
-
- **ESM-only**, native subpath exports
|
|
164
|
-
- **Minimal runtime deps** — CLI packages (`chalk`, `commander`, `figlet`, …) are `optionalDependencies` and only fetched when you opt in to the CLI
|
|
165
|
-
- Comprehensive **test coverage**
|
|
166
|
-
|
|
167
182
|
## Development
|
|
168
183
|
|
|
169
184
|
```bash
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new AbortController and returns its controller and signal.
|
|
3
|
+
* @returns {{ controller: AbortController, signal: AbortSignal }}
|
|
4
|
+
*/
|
|
5
|
+
export declare function createAbortController(): {
|
|
6
|
+
controller: AbortController;
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Returns a promise that rejects when the given AbortSignal is aborted.
|
|
11
|
+
* @param signal The AbortSignal to listen to.
|
|
12
|
+
* @returns {Promise<never>}
|
|
13
|
+
*/
|
|
14
|
+
export declare function abortPromise(signal: AbortSignal): Promise<never>;
|
|
15
|
+
/**
|
|
16
|
+
* Wraps a promise and rejects it if the signal is aborted.
|
|
17
|
+
* @param promise The promise to wrap.
|
|
18
|
+
* @param signal The AbortSignal.
|
|
19
|
+
* @returns {Promise<T>}
|
|
20
|
+
*/
|
|
21
|
+
export declare function withAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Aborts the given controller after a timeout (ms).
|
|
24
|
+
* @param controller The AbortController.
|
|
25
|
+
* @param ms Timeout in milliseconds.
|
|
26
|
+
* @returns {NodeJS.Timeout | number} The timeout ID.
|
|
27
|
+
*/
|
|
28
|
+
export declare function abortAfter(controller: AbortController, ms: number): ReturnType<typeof setTimeout>;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abortController/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB;;;EAGpC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAchE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAEjG"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first element of an array, or undefined if the array is empty.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* first([1, 2, 3]) // 1
|
|
7
|
+
* first([]) // undefined
|
|
8
|
+
* first(['a', 'b']) // 'a'
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @param arr The array to get the first element from
|
|
12
|
+
* @returns The first element or undefined if array is empty
|
|
13
|
+
* @category Array Utilities
|
|
14
|
+
*/
|
|
15
|
+
export declare function first<T>(arr: T[]): T | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the last element of an array, or undefined if the array is empty.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* last([1, 2, 3]) // 3
|
|
22
|
+
* last([]) // undefined
|
|
23
|
+
* last(['a', 'b']) // 'b'
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param arr The array to get the last element from
|
|
27
|
+
* @returns The last element or undefined if array is empty
|
|
28
|
+
* @category Array Utilities
|
|
29
|
+
*/
|
|
30
|
+
export declare function last<T>(arr: T[]): T | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Removes duplicate values from an array while preserving order.
|
|
33
|
+
* Uses Set for O(n) performance with primitive values.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* unique([1, 2, 2, 3, 1]) // [1, 2, 3]
|
|
38
|
+
* unique(['a', 'b', 'a']) // ['a', 'b']
|
|
39
|
+
* unique([{id: 1}, {id: 2}, {id: 1}]) // [{id: 1}, {id: 2}, {id: 1}] (objects by reference)
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param arr The array to remove duplicates from
|
|
43
|
+
* @returns A new array with unique values
|
|
44
|
+
* @category Array Utilities
|
|
45
|
+
*/
|
|
46
|
+
export declare function unique<T>(arr: T[]): T[];
|
|
47
|
+
/**
|
|
48
|
+
* Flattens an array one level deep.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* flatten([[1, 2], [3, 4]]) // [1, 2, 3, 4]
|
|
53
|
+
* flatten([1, [2, 3], 4]) // [1, 2, 3, 4]
|
|
54
|
+
* flatten([[1, [2]], [3]]) // [1, [2], 3] (only one level deep)
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param arr The array to flatten
|
|
58
|
+
* @returns A new flattened array
|
|
59
|
+
* @category Array Utilities
|
|
60
|
+
*/
|
|
61
|
+
export declare function flatten<T>(arr: readonly (T | T[])[]): T[];
|
|
62
|
+
/**
|
|
63
|
+
* Chunks an array into smaller arrays of a specified size.
|
|
64
|
+
* The last chunk may be smaller if the array length is not evenly divisible.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
|
|
69
|
+
* chunk(['a', 'b', 'c'], 2) // [['a', 'b'], ['c']]
|
|
70
|
+
* chunk([1, 2, 3], 5) // [[1, 2, 3]]
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param arr The array to chunk
|
|
74
|
+
* @param size The size of each chunk (must be positive)
|
|
75
|
+
* @returns An array of chunks
|
|
76
|
+
* @throws {Error} When size is less than 1
|
|
77
|
+
* @category Array Utilities
|
|
78
|
+
*/
|
|
79
|
+
export declare function chunk<T>(arr: T[], size: number): T[][];
|
|
80
|
+
/**
|
|
81
|
+
* Removes all falsy values from an array.
|
|
82
|
+
* Falsy values: false, 0, -0, 0n, "", null, undefined, NaN
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* compact([0, 1, false, 2, '', 3, null, undefined, NaN]) // [1, 2, 3]
|
|
87
|
+
* compact(['', 'hello', 0, 'world']) // ['hello', 'world']
|
|
88
|
+
* compact([true, false, 1, 0]) // [true, 1]
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param arr The array to filter
|
|
92
|
+
* @returns A new array with only truthy values
|
|
93
|
+
* @category Array Utilities
|
|
94
|
+
*/
|
|
95
|
+
export declare function compact<T>(arr: T[]): T[];
|
|
96
|
+
/**
|
|
97
|
+
* Shuffles an array using the Fisher-Yates algorithm.
|
|
98
|
+
* Returns a new array without modifying the original.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* shuffle([1, 2, 3, 4, 5]) // [3, 1, 5, 2, 4] (random order)
|
|
103
|
+
* shuffle(['a', 'b', 'c']) // ['c', 'a', 'b'] (random order)
|
|
104
|
+
*
|
|
105
|
+
* // Original array is unchanged
|
|
106
|
+
* const original = [1, 2, 3]
|
|
107
|
+
* const shuffled = shuffle(original)
|
|
108
|
+
* console.log(original) // [1, 2, 3]
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @param arr The array to shuffle
|
|
112
|
+
* @returns A new shuffled array
|
|
113
|
+
* @category Array Utilities
|
|
114
|
+
*/
|
|
115
|
+
export declare function shuffle<T>(arr: T[]): T[];
|
|
116
|
+
/**
|
|
117
|
+
* Groups array elements by a key derived from each element.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* groupBy([1, 2, 3, 4], n => n % 2 === 0 ? 'even' : 'odd')
|
|
122
|
+
* // { odd: [1, 3], even: [2, 4] }
|
|
123
|
+
*
|
|
124
|
+
* groupBy([{ type: 'a' }, { type: 'b' }, { type: 'a' }], x => x.type)
|
|
125
|
+
* // { a: [{ type: 'a' }, { type: 'a' }], b: [{ type: 'b' }] }
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @param arr The array to group
|
|
129
|
+
* @param fn Function that returns the group key for each element
|
|
130
|
+
* @returns An object mapping keys to arrays of elements
|
|
131
|
+
* @category Array Utilities
|
|
132
|
+
*/
|
|
133
|
+
export declare function groupBy<T>(arr: T[], fn: (item: T) => string | number): Record<string | number, T[]>;
|
|
134
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/arrays/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAEhD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAE/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEvC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEzD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAOtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAExC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAOxC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACxB,GAAG,EAAE,CAAC,EAAE,EACR,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAC9B,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,CAO9B"}
|
package/dist/arrays/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function u(n){return n[0]}function T(n){return n.length?n[n.length-1]:void 0}function f(n){return Array.from(new Set(n))}function i(n){return n.flat()}function l(n,e){if(e<1)throw new Error("Chunk size must be at least 1");let t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function s(n){return n.filter(Boolean)}function c(n){let e=n.slice();for(let t=e.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}function h(n,e){return n.reduce((t,r)=>{let o=e(r);return t[o]||(t[o]=[]),t[o].push(r),t},{})}export{l as chunk,s as compact,u as first,i as flatten,h as groupBy,T as last,c as shuffle,f as unique};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value to a boolean.
|
|
3
|
+
* Accepts 'true', '1', 1 as true; 'false', '0', 0 as false.
|
|
4
|
+
* @param value The value to convert.
|
|
5
|
+
* @returns The boolean representation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function toBoolean(value: unknown): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a value is a boolean.
|
|
10
|
+
* @param value The value to check.
|
|
11
|
+
* @returns True if the value is a boolean, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the logical exclusive OR (XOR) of two booleans.
|
|
16
|
+
* @param a First boolean.
|
|
17
|
+
* @param b Second boolean.
|
|
18
|
+
* @returns True if exactly one of a or b is true.
|
|
19
|
+
*/
|
|
20
|
+
export declare function xor(a: boolean, b: boolean): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Logical AND for two booleans.
|
|
23
|
+
* @param a First boolean.
|
|
24
|
+
* @param b Second boolean.
|
|
25
|
+
* @returns True if both a and b are true.
|
|
26
|
+
*/
|
|
27
|
+
export declare function and(a: boolean, b: boolean): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Logical OR for two booleans.
|
|
30
|
+
* @param a First boolean.
|
|
31
|
+
* @param b Second boolean.
|
|
32
|
+
* @returns True if either a or b is true.
|
|
33
|
+
*/
|
|
34
|
+
export declare function or(a: boolean, b: boolean): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Logical NOT for a boolean.
|
|
37
|
+
* @param a The boolean to negate.
|
|
38
|
+
* @returns The negated boolean.
|
|
39
|
+
*/
|
|
40
|
+
export declare function not(a: boolean): boolean;
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/boolean/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWjD;AAED;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAElD;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEvC"}
|
package/dist/boolean/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function e(o){if(typeof o=="boolean")return o;if(typeof o=="string"){let n=o.trim().toLowerCase();if(n==="true"||n==="1")return!0;if(n==="false"||n==="0")return!1}return typeof o=="number"?o===1:!!o}function r(o){return typeof o=="boolean"}function t(o,n){return!!(o?!n:n)}function a(o,n){return o&&n}function f(o,n){return o||n}function
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function e(o){if(typeof o=="boolean")return o;if(typeof o=="string"){let n=o.trim().toLowerCase();if(n==="true"||n==="1")return!0;if(n==="false"||n==="0")return!1}return typeof o=="number"?o===1:!!o}function r(o){return typeof o=="boolean"}function t(o,n){return!!(o?!n:n)}function a(o,n){return o&&n}function f(o,n){return o||n}function u(o){return!o}export{a as and,r as isBoolean,u as not,f as or,e as toBoolean,t as xor};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random hex color string.
|
|
3
|
+
*
|
|
4
|
+
* @returns {string} A string representing a random color in hexadecimal format (e.g., `#a1b2c3`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function randomColor(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Generates a random color with a given alpha value.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @param {string} color
|
|
12
|
+
* @return {*}
|
|
13
|
+
*/
|
|
14
|
+
export declare function matchingTextColor(color: string): "#000" | "#fff";
|
|
15
|
+
/**
|
|
16
|
+
* Converts a hex color string to an RGB object.
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @param {string} hex
|
|
20
|
+
* @return {*} {({ r: number; g: number; b: number } | null)}
|
|
21
|
+
*/
|
|
22
|
+
export declare function hexToRgb(hex: string): {
|
|
23
|
+
r: number;
|
|
24
|
+
g: number;
|
|
25
|
+
b: number;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Converts RGB values to a hex color string.
|
|
29
|
+
*
|
|
30
|
+
* @export
|
|
31
|
+
* @param {number} r
|
|
32
|
+
* @param {number} g
|
|
33
|
+
* @param {number} b
|
|
34
|
+
* @return {*} {string}
|
|
35
|
+
*/
|
|
36
|
+
export declare function rgbToHex(r: number, g: number, b: number): string;
|
|
37
|
+
/**
|
|
38
|
+
* Converts a hex color string to an HSL object.
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
* @param {string} hex
|
|
42
|
+
* @return {*} {({ h: number; s: number; l: number } | null)}
|
|
43
|
+
*/
|
|
44
|
+
export declare function isValidHex(hex: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Darkens a hex color by a given percentage.
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
* @param {string} hex
|
|
50
|
+
* @param {number} percent
|
|
51
|
+
* @return {*} {string}
|
|
52
|
+
*/
|
|
53
|
+
export declare function darken(hex: string, percent: number): string;
|
|
54
|
+
/**
|
|
55
|
+
* Lightens a hex color by a given percentage.
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @param {string} hex
|
|
59
|
+
* @param {number} percent
|
|
60
|
+
* @return {*} {string}
|
|
61
|
+
*/
|
|
62
|
+
export declare function lighten(hex: string, percent: number): string;
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/colors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAKpC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,mBAO9C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQhF;AAED;;;;;;;;GAQG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO5D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Console utility functions for logging and disabling console output in production.
|
|
3
|
+
* @module console
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Disables console output in production environment.
|
|
7
|
+
*/
|
|
8
|
+
export declare const disableConsole: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Clears the console.
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @return {*} {void}
|
|
14
|
+
*/
|
|
15
|
+
export declare const clearConsole: () => void;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/console/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,YAK1B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hashes a string using the specified algorithm.
|
|
3
|
+
* @param str The string to hash.
|
|
4
|
+
* @param algorithm The hash algorithm (default: 'sha256').
|
|
5
|
+
* @returns The hex-encoded hash.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hashString(str: string, algorithm?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Generates a random hex string of the specified length (in bytes).
|
|
10
|
+
* @param length The number of bytes (not hex chars).
|
|
11
|
+
* @returns A random hex string.
|
|
12
|
+
*/
|
|
13
|
+
export declare function randomHex(length?: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an HMAC hash of a string using a secret and algorithm.
|
|
16
|
+
* @param str The string to hash.
|
|
17
|
+
* @param secret The secret key.
|
|
18
|
+
* @param algorithm The hash algorithm (default: 'sha256').
|
|
19
|
+
* @returns The hex-encoded HMAC.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hmacHash(str: string, secret: string, algorithm?: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Encodes a string to base64.
|
|
24
|
+
* @param str The string to encode.
|
|
25
|
+
* @returns The base64-encoded string.
|
|
26
|
+
*/
|
|
27
|
+
export declare function base64Encode(str: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Decodes a base64 string.
|
|
30
|
+
* @param b64 The base64 string to decode.
|
|
31
|
+
* @returns The decoded string.
|
|
32
|
+
*/
|
|
33
|
+
export declare function base64Decode(b64: string): string;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,MAAM,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAK,GAAG,MAAM,CAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of supported currency codes.
|
|
3
|
+
*
|
|
4
|
+
* This array contains ISO 4217 currency codes and some special codes
|
|
5
|
+
* (such as precious metals and testing codes) used in financial applications.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* - Some codes represent fiat currencies (e.g., 'USD', 'EUR').
|
|
9
|
+
* - Some codes represent precious metals (e.g., 'XAU' for gold).
|
|
10
|
+
* - Some codes are reserved for testing or special purposes (e.g., 'XTS', 'XXX').
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://www.iso.org/iso-4217-currency-codes.html ISO 4217 Currency Codes}
|
|
13
|
+
*/
|
|
14
|
+
export declare const currencies: string[];
|
|
15
|
+
export default currencies;
|
|
16
|
+
//# sourceMappingURL=currencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencies.d.ts","sourceRoot":"","sources":["../../src/currency/currencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,UA4CtB,CAAA;AAED,eAAe,UAAU,CAAA"}
|