@rtorcato/js-common 1.2.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/CONTRIBUTORS.md +97 -0
  3. package/LICENSE +21 -0
  4. package/README.md +199 -0
  5. package/dist/abortController/index.d.ts +29 -0
  6. package/dist/abortController/index.d.ts.map +1 -0
  7. package/dist/abortController/index.js +1 -0
  8. package/dist/arrays/index.d.ts +44 -0
  9. package/dist/arrays/index.d.ts.map +1 -0
  10. package/dist/arrays/index.js +1 -0
  11. package/dist/boolean/index.d.ts +41 -0
  12. package/dist/boolean/index.d.ts.map +1 -0
  13. package/dist/boolean/index.js +1 -0
  14. package/dist/chunks/chunk-7MXMG6WN.js +1 -0
  15. package/dist/chunks/chunk-ANN5UYCF.js +1 -0
  16. package/dist/chunks/chunk-DCFILRIS.js +1 -0
  17. package/dist/chunks/chunk-W72HFHZY.js +1 -0
  18. package/dist/chunks/chunk-XAQ7VMV4.js +1 -0
  19. package/dist/cli/index.cjs +3711 -0
  20. package/dist/colors/index.d.ts +63 -0
  21. package/dist/colors/index.d.ts.map +1 -0
  22. package/dist/colors/index.js +1 -0
  23. package/dist/console/index.d.ts +16 -0
  24. package/dist/console/index.d.ts.map +1 -0
  25. package/dist/console/index.js +1 -0
  26. package/dist/crypto/index.d.ts +34 -0
  27. package/dist/crypto/index.d.ts.map +1 -0
  28. package/dist/crypto/index.js +1 -0
  29. package/dist/currency/currencies.d.ts +16 -0
  30. package/dist/currency/currencies.d.ts.map +1 -0
  31. package/dist/currency/currencies.js +1 -0
  32. package/dist/currency/index.d.ts +52 -0
  33. package/dist/currency/index.d.ts.map +1 -0
  34. package/dist/currency/index.js +1 -0
  35. package/dist/date/index.d.ts +44 -0
  36. package/dist/date/index.d.ts.map +1 -0
  37. package/dist/date/index.js +1 -0
  38. package/dist/datetime/index.d.ts +52 -0
  39. package/dist/datetime/index.d.ts.map +1 -0
  40. package/dist/datetime/index.js +1 -0
  41. package/dist/emails/banned/index.d.ts +9 -0
  42. package/dist/emails/banned/index.d.ts.map +1 -0
  43. package/dist/emails/index.d.ts +26 -0
  44. package/dist/emails/index.d.ts.map +1 -0
  45. package/dist/emails/index.js +1 -0
  46. package/dist/env/index.d.ts +63 -0
  47. package/dist/env/index.d.ts.map +1 -0
  48. package/dist/env/index.js +3 -0
  49. package/dist/errors/index.d.ts +39 -0
  50. package/dist/errors/index.d.ts.map +1 -0
  51. package/dist/errors/index.js +1 -0
  52. package/dist/events/index.d.ts +35 -0
  53. package/dist/events/index.d.ts.map +1 -0
  54. package/dist/events/index.js +1 -0
  55. package/dist/fetch/index.d.ts +38 -0
  56. package/dist/fetch/index.d.ts.map +1 -0
  57. package/dist/fetch/index.js +1 -0
  58. package/dist/file/index.d.ts +32 -0
  59. package/dist/file/index.d.ts.map +1 -0
  60. package/dist/file/index.js +1 -0
  61. package/dist/formatting/index.d.ts +52 -0
  62. package/dist/formatting/index.d.ts.map +1 -0
  63. package/dist/formatting/index.js +1 -0
  64. package/dist/functions/index.d.ts +33 -0
  65. package/dist/functions/index.d.ts.map +1 -0
  66. package/dist/functions/index.js +1 -0
  67. package/dist/geometry/index.d.ts +58 -0
  68. package/dist/geometry/index.d.ts.map +1 -0
  69. package/dist/geometry/index.js +1 -0
  70. package/dist/html/index.d.ts +31 -0
  71. package/dist/html/index.d.ts.map +1 -0
  72. package/dist/html/index.js +1 -0
  73. package/dist/i18n/index.d.ts +37 -0
  74. package/dist/i18n/index.d.ts.map +1 -0
  75. package/dist/i18n/index.js +1 -0
  76. package/dist/index.d.ts +3 -0
  77. package/dist/index.d.ts.map +1 -0
  78. package/dist/index.js +1 -0
  79. package/dist/interval/index.d.ts +13 -0
  80. package/dist/interval/index.d.ts.map +1 -0
  81. package/dist/interval/index.js +1 -0
  82. package/dist/json/index.d.ts +28 -0
  83. package/dist/json/index.d.ts.map +1 -0
  84. package/dist/json/index.js +1 -0
  85. package/dist/logger/logger.d.ts +3 -0
  86. package/dist/logger/logger.d.ts.map +1 -0
  87. package/dist/logging/index.d.ts +28 -0
  88. package/dist/logging/index.d.ts.map +1 -0
  89. package/dist/logging/index.js +1 -0
  90. package/dist/logging/index1.d.ts +33 -0
  91. package/dist/logging/index1.d.ts.map +1 -0
  92. package/dist/logging/index1.js +1 -0
  93. package/dist/maps/index.d.ts +32 -0
  94. package/dist/maps/index.d.ts.map +1 -0
  95. package/dist/maps/index.js +1 -0
  96. package/dist/math/index.d.ts +3 -0
  97. package/dist/math/index.d.ts.map +1 -0
  98. package/dist/math/index.js +1 -0
  99. package/dist/math/math.d.ts +37 -0
  100. package/dist/math/math.d.ts.map +1 -0
  101. package/dist/math/math.js +1 -0
  102. package/dist/math/sum/index.d.ts +3 -0
  103. package/dist/math/sum/index.d.ts.map +1 -0
  104. package/dist/mime-types/db.d.ts +4605 -0
  105. package/dist/mime-types/db.d.ts.map +1 -0
  106. package/dist/mime-types/db.js +1 -0
  107. package/dist/mime-types/index.d.ts +25 -0
  108. package/dist/mime-types/index.d.ts.map +1 -0
  109. package/dist/mime-types/index.js +7 -0
  110. package/dist/node/index.d.ts +52 -0
  111. package/dist/node/index.d.ts.map +1 -0
  112. package/dist/node/index.js +1 -0
  113. package/dist/numbers/index.d.ts +74 -0
  114. package/dist/numbers/index.d.ts.map +1 -0
  115. package/dist/numbers/index.js +1 -0
  116. package/dist/obects/index.d.ts +34 -0
  117. package/dist/obects/index.d.ts.map +1 -0
  118. package/dist/obects/index.js +1 -0
  119. package/dist/os/index.d.ts +26 -0
  120. package/dist/os/index.d.ts.map +1 -0
  121. package/dist/os/index.js +1 -0
  122. package/dist/process/index.d.ts +31 -0
  123. package/dist/process/index.d.ts.map +1 -0
  124. package/dist/process/index.js +1 -0
  125. package/dist/promises/index.d.ts +39 -0
  126. package/dist/promises/index.d.ts.map +1 -0
  127. package/dist/promises/index.js +1 -0
  128. package/dist/random/index.d.ts +33 -0
  129. package/dist/random/index.d.ts.map +1 -0
  130. package/dist/random/index.js +1 -0
  131. package/dist/regex/index.d.ts +36 -0
  132. package/dist/regex/index.d.ts.map +1 -0
  133. package/dist/regex/index.js +1 -0
  134. package/dist/security/index.d.ts +14 -0
  135. package/dist/security/index.d.ts.map +1 -0
  136. package/dist/security/index.js +1 -0
  137. package/dist/sets/index.d.ts +48 -0
  138. package/dist/sets/index.d.ts.map +1 -0
  139. package/dist/sets/index.js +1 -0
  140. package/dist/sleep/index.d.ts +27 -0
  141. package/dist/sleep/index.d.ts.map +1 -0
  142. package/dist/sleep/index.js +1 -0
  143. package/dist/strings/index.d.ts +74 -0
  144. package/dist/strings/index.d.ts.map +1 -0
  145. package/dist/strings/index.js +1 -0
  146. package/dist/system/index.d.ts +36 -0
  147. package/dist/system/index.d.ts.map +1 -0
  148. package/dist/system/index.js +1 -0
  149. package/dist/time/index.d.ts +36 -0
  150. package/dist/time/index.d.ts.map +1 -0
  151. package/dist/time/index.js +1 -0
  152. package/dist/try/attempt.d.ts +8 -0
  153. package/dist/try/attempt.d.ts.map +1 -0
  154. package/dist/try/attempt.js +1 -0
  155. package/dist/try/index.d.ts +2 -0
  156. package/dist/try/index.d.ts.map +1 -0
  157. package/dist/try/index.js +1 -0
  158. package/dist/try/trycatch.d.ts +12 -0
  159. package/dist/try/trycatch.d.ts.map +1 -0
  160. package/dist/try/trycatch.js +1 -0
  161. package/dist/url/index.d.ts +40 -0
  162. package/dist/url/index.d.ts.map +1 -0
  163. package/dist/url/index.js +1 -0
  164. package/dist/uuid/index.d.ts +40 -0
  165. package/dist/uuid/index.d.ts.map +1 -0
  166. package/dist/uuid/index.js +1 -0
  167. package/dist/validation/index.d.ts +49 -0
  168. package/dist/validation/index.d.ts.map +1 -0
  169. package/dist/validation/index.js +1 -0
  170. package/package.json +290 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # [1.2.0](https://github.com/rtorcato/js-common/compare/v1.1.0...v1.2.0) (2025-10-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove commitlint dependency from release job ([dbf2795](https://github.com/rtorcato/js-common/commit/dbf27956698b40d68c29dcaba62c5498b8bb7f52))
7
+
8
+
9
+ ### Features
10
+
11
+ * modernize CI/CD workflow with js-tooling structure ([a46b6bf](https://github.com/rtorcato/js-common/commit/a46b6bf73696def0be74136d872ece3a0447ce2d))
12
+
13
+ # Changelog
14
+
15
+ All notable changes to this project will be documented in this file.
16
+
17
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
18
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
19
+
20
+ ## [1.0.0] - 2025-10-24
21
+
22
+ ### Added
23
+ - Initial public release on GitHub and npm
24
+ - Comprehensive JavaScript/TypeScript utilities library
25
+ - Support for arrays, strings, dates, validation, crypto, and more
26
+ - Full TypeScript support with type definitions
27
+ - Modular imports for tree-shaking optimization
28
+
29
+ ### Changed
30
+ - Migrated from GitLab to GitHub
31
+ - Changed from private to public package
32
+ - Updated to MIT license
@@ -0,0 +1,97 @@
1
+ # Contributors
2
+
3
+ Thank you to all the people who have contributed to this project! 🎉
4
+
5
+ ## Core Contributors
6
+
7
+ - **Richard Torcato** ([@rtorcato](https://github.com/rtorcato)) - Creator and maintainer
8
+
9
+ ## How to Contribute
10
+
11
+ We welcome contributions from everyone! Here's how you can help:
12
+
13
+ ### 🐛 Bug Reports
14
+ - Check if the issue already exists in [GitHub Issues](https://github.com/rtorcato/js-common/issues)
15
+ - Create a new issue with a clear description and reproduction steps
16
+ - Include relevant code examples and error messages
17
+
18
+ ### 💡 Feature Requests
19
+ - Open an issue to discuss new features before implementing
20
+ - Explain the use case and benefits
21
+ - Consider backward compatibility
22
+
23
+ ### 🔧 Code Contributions
24
+ 1. Fork the repository
25
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
26
+ 3. Make your changes following our coding standards
27
+ 4. Add tests for new functionality
28
+ 5. Ensure all tests pass (`pnpm test`)
29
+ 6. Run linting and formatting (`pnpm run check:fix`)
30
+ 7. Commit your changes (`git commit -m 'feat: add amazing feature'`)
31
+ 8. Push to your branch (`git push origin feature/amazing-feature`)
32
+ 9. Open a Pull Request
33
+
34
+ ### 📝 Documentation
35
+ - Improve README.md, code comments, or JSDoc
36
+ - Add examples for existing functions
37
+ - Fix typos or clarify explanations
38
+
39
+ ### 🧪 Testing
40
+ - Add test cases for existing functions
41
+ - Improve test coverage
42
+ - Report test failures
43
+
44
+ ## Development Setup
45
+
46
+ ```bash
47
+ # Clone the repository
48
+ git clone https://github.com/rtorcato/js-common.git
49
+ cd js-common
50
+
51
+ # Install dependencies
52
+ pnpm install
53
+
54
+ # Run tests
55
+ pnpm test
56
+
57
+ # Build the project
58
+ pnpm run build-prod
59
+
60
+ # Run linting and formatting
61
+ pnpm run check:fix
62
+ ```
63
+
64
+ ## Code Style
65
+
66
+ This project uses:
67
+ - **Biome** for linting and formatting
68
+ - **TypeScript** for type safety
69
+ - **Vitest** for testing
70
+ - **Conventional Commits** for commit messages
71
+
72
+ ## Commit Message Convention
73
+
74
+ We follow [Conventional Commits](https://conventionalcommits.org/):
75
+
76
+ - `feat:` - New features
77
+ - `fix:` - Bug fixes
78
+ - `docs:` - Documentation changes
79
+ - `style:` - Code style changes (formatting, etc.)
80
+ - `refactor:` - Code refactoring
81
+ - `test:` - Adding or updating tests
82
+ - `chore:` - Maintenance tasks
83
+
84
+ ## Recognition
85
+
86
+ All contributors will be:
87
+ - Listed in this file
88
+ - Mentioned in release notes for their contributions
89
+ - Given credit in the project's acknowledgments
90
+
91
+ ## Questions?
92
+
93
+ Feel free to open an issue or reach out to the maintainers if you have any questions about contributing!
94
+
95
+ ---
96
+
97
+ *This project follows the [Contributor Covenant](https://www.contributor-covenant.org/) Code of Conduct.*
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Richard Torcato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # js-common
2
+
3
+ [![npm version](https://badge.fury.io/js/%40rtorcato%2Fjs-common.svg)](https://badge.fury.io/js/%40rtorcato%2Fjs-common)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
6
+ [![Bundle Size](https://img.shields.io/badge/Bundle%20Size-277%20bytes-green.svg)](https://bundlejs.com/?q=@rtorcato/js-common)
7
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
8
+
9
+ A comprehensive set of common JavaScript and TypeScript utilities for Node.js projects.
10
+
11
+ ## ✨ Features
12
+
13
+ - 🚀 **Ultra-lightweight** - Only 277 bytes main bundle
14
+ - 📦 **Tree-shakeable** - Import only what you need
15
+ - 🔧 **TypeScript** - Full type safety and IntelliSense
16
+ - 🖥️ **CLI included** - Use utilities from command line
17
+ - 📚 **Modular** - Import individual modules
18
+ - ⚡ **Zero dependencies** - Core library has no external deps
19
+ - 🧪 **Well tested** - Comprehensive test coverage
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install @rtorcato/js-common
25
+ ```
26
+
27
+ ## CLI Usage
28
+
29
+ This package includes a command-line interface for many utilities:
30
+
31
+ ```bash
32
+ # Install globally to use the CLI
33
+ npm install -g @rtorcato/js-common
34
+
35
+ # Or use with npx
36
+ npx @rtorcato/js-common --help
37
+
38
+ # Examples
39
+ npx @rtorcato/js-common date today
40
+ npx @rtorcato/js-common math sum 1 2 3 4 5
41
+ npx @rtorcato/js-common text capitalize "hello world"
42
+ npx @rtorcato/js-common security token
43
+ ```
44
+
45
+ See [CLI.md](./CLI.md) for complete CLI documentation.
46
+
47
+ ## Library Usage
48
+
49
+ ```typescript
50
+ // 🎯 Import specific modules (recommended for tree-shaking)
51
+ import { formatDate, today, daysBetween } from '@rtorcato/js-common/date'
52
+ import { validateEmail, isValidEmail } from '@rtorcato/js-common/emails'
53
+ import { generateUUID, isValidUUID } from '@rtorcato/js-common/uuid'
54
+ import { sum, average, roundTo } from '@rtorcato/js-common/numbers'
55
+ import { capitalize, toTitleCase } from '@rtorcato/js-common/formatting'
56
+
57
+ // 📦 Or import everything (larger bundle)
58
+ import * as jsCommon from '@rtorcato/js-common'
59
+
60
+ // Example usage
61
+ console.log(today()) // "2025-10-24"
62
+ console.log(sum([1, 2, 3, 4, 5])) // 15
63
+ console.log(capitalize('hello world')) // "Hello world"
64
+ console.log(generateUUID()) // "f47ac10b-58cc-4372-a567-0e02b2c3d479"
65
+ ```
66
+
67
+ ### Bundle Size Impact
68
+
69
+ The main library bundle is only **277 bytes**! Individual module imports are even smaller:
70
+
71
+ ```typescript
72
+ // This adds ~50 bytes to your bundle
73
+ import { today } from '@rtorcato/js-common/date'
74
+
75
+ // This adds ~100 bytes to your bundle
76
+ import { sum, average } from '@rtorcato/js-common/numbers'
77
+ ```
78
+
79
+ ## Available Modules
80
+
81
+ ### 📅 **Date & Time**
82
+ ```typescript
83
+ import { today, formatDate, daysBetween, isLeapYear } from '@rtorcato/js-common/date'
84
+ import { nowIso, formatDateTimeLocal, unixTimestamp } from '@rtorcato/js-common/datetime'
85
+ import { nowTime, parseTime, secondsBetween } from '@rtorcato/js-common/time'
86
+ ```
87
+
88
+ ### 🔢 **Numbers & Math**
89
+ ```typescript
90
+ import { sum, average, roundTo, clamp, getRandomInt } from '@rtorcato/js-common/numbers'
91
+ import { add, subtract, multiply, divide } from '@rtorcato/js-common/math'
92
+ ```
93
+
94
+ ### 📝 **Text & Strings**
95
+ ```typescript
96
+ import { capitalize, toTitleCase, padZero } from '@rtorcato/js-common/formatting'
97
+ import { slugify, truncate, removeEmojis } from '@rtorcato/js-common/strings'
98
+ ```
99
+
100
+ ### 🔐 **Security & Validation**
101
+ ```typescript
102
+ import { isStrongPassword, generateSecureToken } from '@rtorcato/js-common/security'
103
+ import { isValidEmail, validateEmail } from '@rtorcato/js-common/emails'
104
+ import { isValidUrl } from '@rtorcato/js-common/url'
105
+ import { isString, isNumber, isArray, isObject } from '@rtorcato/js-common/validation'
106
+ ```
107
+
108
+ ### 🗂️ **Data Structures**
109
+ ```typescript
110
+ import { flatten, unique, chunk, groupBy } from '@rtorcato/js-common/arrays'
111
+ import { deepMerge, pick, omit, deepClone } from '@rtorcato/js-common/objects'
112
+ import { safeJsonParse, safeJsonStringify } from '@rtorcato/js-common/json'
113
+ ```
114
+
115
+ ### 🔄 **Async & Control Flow**
116
+ ```typescript
117
+ import { delay, timeout, retry } from '@rtorcato/js-common/promises'
118
+ import { debounce, throttle, once } from '@rtorcato/js-common/functions'
119
+ import { sleep } from '@rtorcato/js-common/sleep'
120
+ ```
121
+
122
+ ### 🌈 **And More...**
123
+ - **Colors** - Color manipulation and conversion
124
+ - **Console** - Enhanced console utilities
125
+ - **Crypto** - Cryptographic functions
126
+ - **Currency** - Currency formatting and conversion
127
+ - **Events** - Event handling utilities
128
+ - **Fetch** - HTTP request utilities
129
+ - **File** - File system utilities
130
+ - **UUID** - UUID generation and validation
131
+ - **Process** - Process and environment utilities
132
+ - **Geometry** - 2D geometry calculations
133
+
134
+ ## Requirements
135
+
136
+ - **Node.js** >= 18.0.0
137
+ - **TypeScript** >= 5.0.0 (for TypeScript projects)
138
+
139
+ ## Why This Library?
140
+
141
+ ### 🎯 **Focused & Lightweight**
142
+ Unlike larger utility libraries, js-common is designed for modern applications:
143
+ - **Tiny bundle size** - Won't bloat your application
144
+ - **Tree-shakeable** - Only import what you use
145
+ - **CLI included** - Use utilities in scripts and terminal
146
+
147
+ ### 📦 **Bundle Size Comparison**
148
+ ```
149
+ lodash: ~70KB (full) / ~25KB (common functions)
150
+ ramda: ~60KB (full) / ~15KB (common functions)
151
+ js-common: 277 bytes (full) / ~50-200 bytes (individual modules)
152
+ ```
153
+
154
+ ### 🛠️ **Modern Development**
155
+ - Built with **TypeScript** for excellent DX
156
+ - **ESM-first** with CommonJS compatibility
157
+ - **Zero dependencies** in core library
158
+ - Comprehensive **test coverage**
159
+
160
+ ## Development
161
+
162
+ ```bash
163
+ # Install dependencies
164
+ pnpm install
165
+
166
+ # Run tests
167
+ pnpm test
168
+
169
+ # Run tests in watch mode
170
+ pnpm test:watch
171
+
172
+ # Build the project
173
+ pnpm run build-prod
174
+
175
+ # Build development version
176
+ pnpm run build-dev
177
+
178
+ # Lint and format
179
+ pnpm run check:fix
180
+
181
+ # Type checking
182
+ pnpm run typecheck
183
+ ```
184
+
185
+ ## Contributing
186
+
187
+ Contributions are welcome! Please read [CONTRIBUTORS.md](./CONTRIBUTORS.md) for guidelines.
188
+
189
+ 1. Fork the repository
190
+ 2. Create a feature branch: `git checkout -b feature-name`
191
+ 3. Make your changes with tests
192
+ 4. Run the test suite: `pnpm test`
193
+ 5. Submit a pull request
194
+
195
+ ## License
196
+
197
+ MIT © [Richard Torcato](https://github.com/rtorcato)
198
+
199
+
@@ -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 @@
1
+ import"../chunks/chunk-ANN5UYCF.js";function n(){let r=new AbortController;return{controller:r,signal:r.signal}}function t(r){return new Promise((e,o)=>{r.aborted?o(new DOMException("Aborted","AbortError")):r.addEventListener("abort",()=>{o(new DOMException("Aborted","AbortError"))},{once:!0})})}function i(r,e){return Promise.race([r,t(e)])}function b(r,e){return setTimeout(()=>r.abort(),e)}export{b as abortAfter,t as abortPromise,n as createAbortController,i as withAbort};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Returns the first element of an array, or undefined if the array is empty.
3
+ * @param arr The array.
4
+ * @returns The first element or undefined.
5
+ */
6
+ export declare function first<T>(arr: T[]): T | undefined;
7
+ /**
8
+ * Returns the last element of an array, or undefined if the array is empty.
9
+ * @param arr The array.
10
+ * @returns The last element or undefined.
11
+ */
12
+ export declare function last<T>(arr: T[]): T | undefined;
13
+ /**
14
+ * Removes duplicate values from an array.
15
+ * @param arr The array.
16
+ * @returns A new array with unique values.
17
+ */
18
+ export declare function unique<T>(arr: T[]): T[];
19
+ /**
20
+ * Flattens an array one level deep.
21
+ * @param arr The array to flatten.
22
+ * @returns A new flattened array.
23
+ */
24
+ export declare function flatten<T>(arr: any[]): T[];
25
+ /**
26
+ * Chunks an array into smaller arrays of a specified size.
27
+ * @param arr The array to chunk.
28
+ * @param size The chunk size.
29
+ * @returns An array of chunks.
30
+ */
31
+ export declare function chunk<T>(arr: T[], size: number): T[][];
32
+ /**
33
+ * Removes all falsy values from an array.
34
+ * @param arr The array.
35
+ * @returns A new array with only truthy values.
36
+ */
37
+ export declare function compact<T>(arr: T[]): T[];
38
+ /**
39
+ * Shuffles an array in place using the Fisher-Yates algorithm.
40
+ * @param arr The array to shuffle.
41
+ * @returns The shuffled array.
42
+ */
43
+ export declare function shuffle<T>(arr: T[]): T[];
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/arrays/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEvC;AAED;;;;GAIG;AAEH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMtD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAExC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAOxC"}
@@ -0,0 +1 @@
1
+ import"../chunks/chunk-ANN5UYCF.js";function r(n){return n[0]}function u(n){return n.length?n[n.length-1]:void 0}function T(n){return Array.from(new Set(n))}function f(n){return n.flat()}function i(n,t){let e=[];for(let o=0;o<n.length;o+=t)e.push(n.slice(o,o+t));return e}function l(n){return n.filter(Boolean)}function c(n){let t=n.slice();for(let e=t.length-1;e>0;e--){let o=Math.floor(Math.random()*(e+1));[t[e],t[o]]=[t[o],t[e]]}return t}export{i as chunk,l as compact,r as first,f as flatten,u as last,c as shuffle,T 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: any): 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: any): 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,GAAG,GAAG,OAAO,CAW7C;AAED;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAEtD;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"}
@@ -0,0 +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 b(o){return!o}export{a as and,r as isBoolean,b as not,f as or,e as toBoolean,t as xor};
@@ -0,0 +1 @@
1
+ var R=["CAD","USD","AUD","EUR","GBP","JPY","CHF","CNY","NZD","SGD","SEK","NOK","DKK","MXN","HKD","KRW","TRY","RUB","INR","BRL","ZAR","ILS","MYR","PHP","PLN","THB","TWD","CZK","HUF","IDR","BGN","RON","HRK","BRL","COP","CRC","XCD","XDR","XAG","XAU","XPT","XPD","XTS","XXX"],D=R;export{R as a,D as b};
@@ -0,0 +1 @@
1
+ var d=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});export{d as a};
@@ -0,0 +1 @@
1
+ var n=(e,r)=>e+r,u=(e,r)=>e-r,b=(e,r)=>e*r,m=(e,r)=>e/r;export{n as a,u as b,b as c,m as d};