Upload folder using huggingface_hub (part 16)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/es-toolkit/LICENSE +21 -0
- node_modules/es-toolkit/README.md +69 -0
- node_modules/es-toolkit/dist/types/Writable.d.mts +15 -0
- node_modules/es-toolkit/dist/types/Writable.d.ts +15 -0
- node_modules/es-toolkit/dist/util/attempt.d.mts +43 -0
- node_modules/es-toolkit/dist/util/attempt.d.ts +43 -0
- node_modules/es-toolkit/dist/util/attempt.js +49 -0
- node_modules/es-toolkit/dist/util/attempt.mjs +49 -0
- node_modules/es-toolkit/dist/util/attemptAsync.d.mts +36 -0
- node_modules/es-toolkit/dist/util/attemptAsync.d.ts +36 -0
- node_modules/es-toolkit/dist/util/attemptAsync.js +42 -0
- node_modules/es-toolkit/dist/util/attemptAsync.mjs +42 -0
- node_modules/es-toolkit/dist/util/index.d.mts +4 -0
- node_modules/es-toolkit/dist/util/index.d.ts +4 -0
- node_modules/es-toolkit/dist/util/index.js +8 -0
- node_modules/es-toolkit/dist/util/index.mjs +4 -0
- node_modules/es-toolkit/dist/util/invariant.d.mts +41 -0
- node_modules/es-toolkit/dist/util/invariant.d.ts +41 -0
- node_modules/es-toolkit/dist/util/invariant.js +32 -0
- node_modules/es-toolkit/dist/util/invariant.mjs +32 -0
- node_modules/es-toolkit/error.d.ts +1 -0
- node_modules/es-toolkit/error.js +1 -0
- node_modules/es-toolkit/fp.d.ts +1 -0
- node_modules/es-toolkit/fp.js +1 -0
- node_modules/es-toolkit/function.d.ts +1 -0
- node_modules/es-toolkit/function.js +1 -0
- node_modules/es-toolkit/map.d.ts +1 -0
- node_modules/es-toolkit/map.js +1 -0
- node_modules/es-toolkit/math.d.ts +1 -0
- node_modules/es-toolkit/math.js +1 -0
- node_modules/es-toolkit/object.d.ts +1 -0
- node_modules/es-toolkit/object.js +1 -0
- node_modules/es-toolkit/package.json +453 -0
- node_modules/es-toolkit/predicate.d.ts +1 -0
- node_modules/es-toolkit/predicate.js +1 -0
- node_modules/es-toolkit/promise.d.ts +1 -0
- node_modules/es-toolkit/promise.js +1 -0
- node_modules/es-toolkit/server.d.ts +1 -0
- node_modules/es-toolkit/server.js +1 -0
- node_modules/es-toolkit/set.d.ts +1 -0
- node_modules/es-toolkit/set.js +1 -0
- node_modules/es-toolkit/src/compat/_internal/Equals.d.ts +1 -0
- node_modules/es-toolkit/src/compat/_internal/IsWritable.d.ts +3 -0
- node_modules/es-toolkit/src/compat/_internal/MutableList.d.ts +4 -0
- node_modules/es-toolkit/src/compat/_internal/RejectReadonly.d.ts +4 -0
- node_modules/es-toolkit/string.d.ts +1 -0
- node_modules/es-toolkit/string.js +1 -0
- node_modules/es-toolkit/types.d.ts +1 -0
- node_modules/es-toolkit/util.d.ts +1 -0
- node_modules/es-toolkit/util.js +1 -0
node_modules/es-toolkit/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 Viva Republica, Inc.
|
| 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.
|
node_modules/es-toolkit/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+

|
| 2 |
+
|
| 3 |
+
# es-toolkit · [](https://github.com/toss/es-toolkit/blob/main/LICENSE) [](https://codecov.io/gh/toss/es-toolkit) [](https://www.npmjs.com/package/es-toolkit) [](https://jsr.io/@es-toolkit/es-toolkit) [](https://discord.gg/vGXbVjP2nY)
|
| 4 |
+
|
| 5 |
+
English | [한국어](https://github.com/toss/es-toolkit/blob/main/README-ko_kr.md) | [简体中文](https://github.com/toss/es-toolkit/blob/main/README-zh_hans.md) | [日本語](https://github.com/toss/es-toolkit/blob/main/README-ja_jp.md)
|
| 6 |
+
|
| 7 |
+
es-toolkit is a state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
|
| 8 |
+
|
| 9 |
+
- es-toolkit offers a variety of everyday utility functions with modern implementations, such as [debounce](https://es-toolkit.dev/reference/function/debounce.html), [delay](https://es-toolkit.dev/reference/promise/delay.html), [chunk](https://es-toolkit.dev/reference/array/chunk.html), [sum](https://es-toolkit.dev/reference/math/sum.html), and [pick](https://es-toolkit.dev/reference/object/pick.html).
|
| 10 |
+
- Designed with performance in mind, es-toolkit achieves [2-3× better performance](https://es-toolkit.dev/performance.html) in modern JavaScript environments.
|
| 11 |
+
- es-toolkit supports tree shaking out of the box, and [reduces JavaScript code by up to 97%](https://es-toolkit.dev/bundle-size.html) compared to other libraries.
|
| 12 |
+
- es-toolkit offers a complete compatibility layer to seamlessly replace lodash, available as [es-toolkit/compat](https://es-toolkit.dev/compatibility.html).
|
| 13 |
+
- es-toolkit includes built-in TypeScript support, with straightforward yet robust types. It also provides useful type guards such as [isNotNil](https://es-toolkit.dev/reference/predicate/isNotNil.html).
|
| 14 |
+
- es-toolkit is trusted and used by popular open-source projects like [Storybook](https://github.com/storybookjs/storybook/blob/9d862798d666678cc4822e857c00bbd744169ced/code/core/package.json#L358), [Recharts](https://github.com/recharts/recharts/blob/0fa4cc325da403b6fa1c6be0f820896ed92f806a/package.json#L94), [ink](https://github.com/vadimdemedes/ink/blob/2090ad9779be59dea71d173eb49785b7bd4495d0/package.json#L55), and [CKEditor](https://github.com/ckeditor/ckeditor5/blob/60d5fac804643cb4d359767ee2f94e3d92d1fcc5/packages/ckeditor5-core/package.json#L53).
|
| 15 |
+
- es-toolkit is battle-tested with 100% test coverage, ensuring reliability and robustness.
|
| 16 |
+
|
| 17 |
+
## Examples
|
| 18 |
+
|
| 19 |
+
```tsx
|
| 20 |
+
// import from '@es-toolkit/es-toolkit' in jsr.
|
| 21 |
+
import { chunk, debounce } from 'es-toolkit';
|
| 22 |
+
|
| 23 |
+
const debouncedLog = debounce(message => {
|
| 24 |
+
console.log(message);
|
| 25 |
+
}, 300);
|
| 26 |
+
|
| 27 |
+
// This call will be debounced
|
| 28 |
+
debouncedLog('Hello, world!');
|
| 29 |
+
|
| 30 |
+
const array = [1, 2, 3, 4, 5, 6];
|
| 31 |
+
const chunkedArray = chunk(array, 2);
|
| 32 |
+
|
| 33 |
+
console.log(chunkedArray);
|
| 34 |
+
// Output: [[1, 2], [3, 4], [5, 6]]
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## AI Integration
|
| 38 |
+
|
| 39 |
+
es-toolkit provides [Agent Skills](https://skills.sh) for AI coding tools like Claude Code, Cursor, and Copilot.
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
npx skills add toss/es-toolkit
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
For Claude Code, you can also install via the plugin marketplace:
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
/plugin marketplace add toss/es-toolkit
|
| 49 |
+
/plugin install es-toolkit@es-toolkit-plugin
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
For more details, see the [AI Integration guide](https://es-toolkit.dev/ai-integration.html).
|
| 53 |
+
|
| 54 |
+
## Contributing
|
| 55 |
+
|
| 56 |
+
We welcome contribution from everyone in the community. Read below for detailed contribution guide.
|
| 57 |
+
|
| 58 |
+
[CONTRIBUTING](https://github.com/toss/es-toolkit/blob/main/.github/CONTRIBUTING.md)
|
| 59 |
+
|
| 60 |
+
## License
|
| 61 |
+
|
| 62 |
+
MIT © Viva Republica, Inc. See [LICENSE](./LICENSE) for details.
|
| 63 |
+
|
| 64 |
+
<a title="Toss" href="https://toss.im">
|
| 65 |
+
<picture>
|
| 66 |
+
<source media="(prefers-color-scheme: dark)" srcset="https://static.toss.im/logos/png/4x/logo-toss-reverse.png">
|
| 67 |
+
<img alt="Toss" src="https://static.toss.im/logos/png/4x/logo-toss.png" width="100">
|
| 68 |
+
</picture>
|
| 69 |
+
</a>
|
node_modules/es-toolkit/dist/types/Writable.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/types/Writable.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Removes the `readonly` modifier from all properties of `T`.
|
| 4 |
+
* The inverse of the built-in `Readonly`.
|
| 5 |
+
*
|
| 6 |
+
* @template T - The object type to make writable.
|
| 7 |
+
*
|
| 8 |
+
* @example
|
| 9 |
+
* type Config = { readonly host: string; readonly port: number };
|
| 10 |
+
* type MutableConfig = Writable<Config>;
|
| 11 |
+
* // => { host: string; port: number }
|
| 12 |
+
*/
|
| 13 |
+
type Writable<T> = { -readonly [K in keyof T]: T[K] };
|
| 14 |
+
//#endregion
|
| 15 |
+
export { Writable };
|
node_modules/es-toolkit/dist/types/Writable.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/types/Writable.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Removes the `readonly` modifier from all properties of `T`.
|
| 4 |
+
* The inverse of the built-in `Readonly`.
|
| 5 |
+
*
|
| 6 |
+
* @template T - The object type to make writable.
|
| 7 |
+
*
|
| 8 |
+
* @example
|
| 9 |
+
* type Config = { readonly host: string; readonly port: number };
|
| 10 |
+
* type MutableConfig = Writable<Config>;
|
| 11 |
+
* // => { host: string; port: number }
|
| 12 |
+
*/
|
| 13 |
+
type Writable<T> = { -readonly [K in keyof T]: T[K] };
|
| 14 |
+
//#endregion
|
| 15 |
+
export { Writable };
|
node_modules/es-toolkit/dist/util/attempt.d.mts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attempt.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute a function and return the result or error.
|
| 4 |
+
* Returns a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the function.
|
| 10 |
+
* @param func - The function to execute.
|
| 11 |
+
* @returns A tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, result] = attempt(() => 42);
|
| 16 |
+
* // [null, 42]
|
| 17 |
+
*
|
| 18 |
+
* // Failed execution
|
| 19 |
+
* const [error, result] = attempt(() => {
|
| 20 |
+
* throw new Error('Something went wrong');
|
| 21 |
+
* });
|
| 22 |
+
* // [Error, null]
|
| 23 |
+
*
|
| 24 |
+
* // With type parameter
|
| 25 |
+
* const [error, names] = attempt<string[]>(() => ['Alice', 'Bob']);
|
| 26 |
+
* // [null, ['Alice', 'Bob']]
|
| 27 |
+
*
|
| 28 |
+
* @note
|
| 29 |
+
* Important: This function is not suitable for async functions (functions that return a `Promise`).
|
| 30 |
+
* When passing an async function, it will return `[null, Promise<Result>]`, but won't catch any
|
| 31 |
+
* errors if the Promise is rejected later.
|
| 32 |
+
*
|
| 33 |
+
* For handling async functions, use the `attemptAsync` function instead:
|
| 34 |
+
* ```
|
| 35 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 36 |
+
* const response = await fetch('https://api.example.com/data');
|
| 37 |
+
* return response.json();
|
| 38 |
+
* });
|
| 39 |
+
* ```
|
| 40 |
+
*/
|
| 41 |
+
declare function attempt<T, E>(func: () => T): [null, T] | [E, null];
|
| 42 |
+
//#endregion
|
| 43 |
+
export { attempt };
|
node_modules/es-toolkit/dist/util/attempt.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attempt.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute a function and return the result or error.
|
| 4 |
+
* Returns a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the function.
|
| 10 |
+
* @param func - The function to execute.
|
| 11 |
+
* @returns A tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, result] = attempt(() => 42);
|
| 16 |
+
* // [null, 42]
|
| 17 |
+
*
|
| 18 |
+
* // Failed execution
|
| 19 |
+
* const [error, result] = attempt(() => {
|
| 20 |
+
* throw new Error('Something went wrong');
|
| 21 |
+
* });
|
| 22 |
+
* // [Error, null]
|
| 23 |
+
*
|
| 24 |
+
* // With type parameter
|
| 25 |
+
* const [error, names] = attempt<string[]>(() => ['Alice', 'Bob']);
|
| 26 |
+
* // [null, ['Alice', 'Bob']]
|
| 27 |
+
*
|
| 28 |
+
* @note
|
| 29 |
+
* Important: This function is not suitable for async functions (functions that return a `Promise`).
|
| 30 |
+
* When passing an async function, it will return `[null, Promise<Result>]`, but won't catch any
|
| 31 |
+
* errors if the Promise is rejected later.
|
| 32 |
+
*
|
| 33 |
+
* For handling async functions, use the `attemptAsync` function instead:
|
| 34 |
+
* ```
|
| 35 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 36 |
+
* const response = await fetch('https://api.example.com/data');
|
| 37 |
+
* return response.json();
|
| 38 |
+
* });
|
| 39 |
+
* ```
|
| 40 |
+
*/
|
| 41 |
+
declare function attempt<T, E>(func: () => T): [null, T] | [E, null];
|
| 42 |
+
//#endregion
|
| 43 |
+
export { attempt };
|
node_modules/es-toolkit/dist/util/attempt.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attempt.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute a function and return the result or error.
|
| 4 |
+
* Returns a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the function.
|
| 10 |
+
* @param func - The function to execute.
|
| 11 |
+
* @returns A tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, result] = attempt(() => 42);
|
| 16 |
+
* // [null, 42]
|
| 17 |
+
*
|
| 18 |
+
* // Failed execution
|
| 19 |
+
* const [error, result] = attempt(() => {
|
| 20 |
+
* throw new Error('Something went wrong');
|
| 21 |
+
* });
|
| 22 |
+
* // [Error, null]
|
| 23 |
+
*
|
| 24 |
+
* // With type parameter
|
| 25 |
+
* const [error, names] = attempt<string[]>(() => ['Alice', 'Bob']);
|
| 26 |
+
* // [null, ['Alice', 'Bob']]
|
| 27 |
+
*
|
| 28 |
+
* @note
|
| 29 |
+
* Important: This function is not suitable for async functions (functions that return a `Promise`).
|
| 30 |
+
* When passing an async function, it will return `[null, Promise<Result>]`, but won't catch any
|
| 31 |
+
* errors if the Promise is rejected later.
|
| 32 |
+
*
|
| 33 |
+
* For handling async functions, use the `attemptAsync` function instead:
|
| 34 |
+
* ```
|
| 35 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 36 |
+
* const response = await fetch('https://api.example.com/data');
|
| 37 |
+
* return response.json();
|
| 38 |
+
* });
|
| 39 |
+
* ```
|
| 40 |
+
*/
|
| 41 |
+
function attempt(func) {
|
| 42 |
+
try {
|
| 43 |
+
return [null, func()];
|
| 44 |
+
} catch (error) {
|
| 45 |
+
return [error, null];
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
//#endregion
|
| 49 |
+
exports.attempt = attempt;
|
node_modules/es-toolkit/dist/util/attempt.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attempt.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute a function and return the result or error.
|
| 4 |
+
* Returns a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the function.
|
| 10 |
+
* @param func - The function to execute.
|
| 11 |
+
* @returns A tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, result] = attempt(() => 42);
|
| 16 |
+
* // [null, 42]
|
| 17 |
+
*
|
| 18 |
+
* // Failed execution
|
| 19 |
+
* const [error, result] = attempt(() => {
|
| 20 |
+
* throw new Error('Something went wrong');
|
| 21 |
+
* });
|
| 22 |
+
* // [Error, null]
|
| 23 |
+
*
|
| 24 |
+
* // With type parameter
|
| 25 |
+
* const [error, names] = attempt<string[]>(() => ['Alice', 'Bob']);
|
| 26 |
+
* // [null, ['Alice', 'Bob']]
|
| 27 |
+
*
|
| 28 |
+
* @note
|
| 29 |
+
* Important: This function is not suitable for async functions (functions that return a `Promise`).
|
| 30 |
+
* When passing an async function, it will return `[null, Promise<Result>]`, but won't catch any
|
| 31 |
+
* errors if the Promise is rejected later.
|
| 32 |
+
*
|
| 33 |
+
* For handling async functions, use the `attemptAsync` function instead:
|
| 34 |
+
* ```
|
| 35 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 36 |
+
* const response = await fetch('https://api.example.com/data');
|
| 37 |
+
* return response.json();
|
| 38 |
+
* });
|
| 39 |
+
* ```
|
| 40 |
+
*/
|
| 41 |
+
function attempt(func) {
|
| 42 |
+
try {
|
| 43 |
+
return [null, func()];
|
| 44 |
+
} catch (error) {
|
| 45 |
+
return [error, null];
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
//#endregion
|
| 49 |
+
export { attempt };
|
node_modules/es-toolkit/dist/util/attemptAsync.d.mts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attemptAsync.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute an async function and return the result or error.
|
| 4 |
+
* Returns a Promise that resolves to a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the async function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the async function.
|
| 10 |
+
* @param func - The async function to execute.
|
| 11 |
+
* @returns A Promise that resolves to a tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 16 |
+
* const response = await fetch('https://api.example.com/data');
|
| 17 |
+
* return response.json();
|
| 18 |
+
* });
|
| 19 |
+
* // If successful: [null, { ... data ... }]
|
| 20 |
+
*
|
| 21 |
+
* // Failed execution
|
| 22 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 23 |
+
* throw new Error('Network error');
|
| 24 |
+
* });
|
| 25 |
+
* // [Error, null]
|
| 26 |
+
*
|
| 27 |
+
* // With type parameter
|
| 28 |
+
* const [error, users] = await attemptAsync<User[]>(async () => {
|
| 29 |
+
* const response = await fetch('https://api.example.com/users');
|
| 30 |
+
* return response.json();
|
| 31 |
+
* });
|
| 32 |
+
* // users is typed as User[]
|
| 33 |
+
*/
|
| 34 |
+
declare function attemptAsync<T, E>(func: () => Promise<T>): Promise<[null, T] | [E, null]>;
|
| 35 |
+
//#endregion
|
| 36 |
+
export { attemptAsync };
|
node_modules/es-toolkit/dist/util/attemptAsync.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attemptAsync.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute an async function and return the result or error.
|
| 4 |
+
* Returns a Promise that resolves to a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the async function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the async function.
|
| 10 |
+
* @param func - The async function to execute.
|
| 11 |
+
* @returns A Promise that resolves to a tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 16 |
+
* const response = await fetch('https://api.example.com/data');
|
| 17 |
+
* return response.json();
|
| 18 |
+
* });
|
| 19 |
+
* // If successful: [null, { ... data ... }]
|
| 20 |
+
*
|
| 21 |
+
* // Failed execution
|
| 22 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 23 |
+
* throw new Error('Network error');
|
| 24 |
+
* });
|
| 25 |
+
* // [Error, null]
|
| 26 |
+
*
|
| 27 |
+
* // With type parameter
|
| 28 |
+
* const [error, users] = await attemptAsync<User[]>(async () => {
|
| 29 |
+
* const response = await fetch('https://api.example.com/users');
|
| 30 |
+
* return response.json();
|
| 31 |
+
* });
|
| 32 |
+
* // users is typed as User[]
|
| 33 |
+
*/
|
| 34 |
+
declare function attemptAsync<T, E>(func: () => Promise<T>): Promise<[null, T] | [E, null]>;
|
| 35 |
+
//#endregion
|
| 36 |
+
export { attemptAsync };
|
node_modules/es-toolkit/dist/util/attemptAsync.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attemptAsync.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute an async function and return the result or error.
|
| 4 |
+
* Returns a Promise that resolves to a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the async function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the async function.
|
| 10 |
+
* @param func - The async function to execute.
|
| 11 |
+
* @returns A Promise that resolves to a tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 16 |
+
* const response = await fetch('https://api.example.com/data');
|
| 17 |
+
* return response.json();
|
| 18 |
+
* });
|
| 19 |
+
* // If successful: [null, { ... data ... }]
|
| 20 |
+
*
|
| 21 |
+
* // Failed execution
|
| 22 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 23 |
+
* throw new Error('Network error');
|
| 24 |
+
* });
|
| 25 |
+
* // [Error, null]
|
| 26 |
+
*
|
| 27 |
+
* // With type parameter
|
| 28 |
+
* const [error, users] = await attemptAsync<User[]>(async () => {
|
| 29 |
+
* const response = await fetch('https://api.example.com/users');
|
| 30 |
+
* return response.json();
|
| 31 |
+
* });
|
| 32 |
+
* // users is typed as User[]
|
| 33 |
+
*/
|
| 34 |
+
async function attemptAsync(func) {
|
| 35 |
+
try {
|
| 36 |
+
return [null, await func()];
|
| 37 |
+
} catch (error) {
|
| 38 |
+
return [error, null];
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
//#endregion
|
| 42 |
+
exports.attemptAsync = attemptAsync;
|
node_modules/es-toolkit/dist/util/attemptAsync.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/attemptAsync.ts
|
| 2 |
+
/**
|
| 3 |
+
* Attempt to execute an async function and return the result or error.
|
| 4 |
+
* Returns a Promise that resolves to a tuple where:
|
| 5 |
+
* - On success: [null, Result] - First element is null, second is the result
|
| 6 |
+
* - On error: [Error, null] - First element is the caught error, second is null
|
| 7 |
+
*
|
| 8 |
+
* @template {unknown} T - The type of the result of the async function.
|
| 9 |
+
* @template {unknown} E - The type of the error that can be thrown by the async function.
|
| 10 |
+
* @param func - The async function to execute.
|
| 11 |
+
* @returns A Promise that resolves to a tuple containing either [null, result] or [error, null].
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Successful execution
|
| 15 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 16 |
+
* const response = await fetch('https://api.example.com/data');
|
| 17 |
+
* return response.json();
|
| 18 |
+
* });
|
| 19 |
+
* // If successful: [null, { ... data ... }]
|
| 20 |
+
*
|
| 21 |
+
* // Failed execution
|
| 22 |
+
* const [error, data] = await attemptAsync(async () => {
|
| 23 |
+
* throw new Error('Network error');
|
| 24 |
+
* });
|
| 25 |
+
* // [Error, null]
|
| 26 |
+
*
|
| 27 |
+
* // With type parameter
|
| 28 |
+
* const [error, users] = await attemptAsync<User[]>(async () => {
|
| 29 |
+
* const response = await fetch('https://api.example.com/users');
|
| 30 |
+
* return response.json();
|
| 31 |
+
* });
|
| 32 |
+
* // users is typed as User[]
|
| 33 |
+
*/
|
| 34 |
+
async function attemptAsync(func) {
|
| 35 |
+
try {
|
| 36 |
+
return [null, await func()];
|
| 37 |
+
} catch (error) {
|
| 38 |
+
return [error, null];
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
//#endregion
|
| 42 |
+
export { attemptAsync };
|
node_modules/es-toolkit/dist/util/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { attempt } from "./attempt.mjs";
|
| 2 |
+
import { attemptAsync } from "./attemptAsync.mjs";
|
| 3 |
+
import { invariant } from "./invariant.mjs";
|
| 4 |
+
export { invariant as assert, attempt, attemptAsync, invariant };
|
node_modules/es-toolkit/dist/util/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { attempt } from "./attempt.js";
|
| 2 |
+
import { attemptAsync } from "./attemptAsync.js";
|
| 3 |
+
import { invariant } from "./invariant.js";
|
| 4 |
+
export { invariant as assert, attempt, attemptAsync, invariant };
|
node_modules/es-toolkit/dist/util/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
| 2 |
+
const require_attempt = require("./attempt.js");
|
| 3 |
+
const require_attemptAsync = require("./attemptAsync.js");
|
| 4 |
+
const require_invariant = require("./invariant.js");
|
| 5 |
+
exports.assert = require_invariant.invariant;
|
| 6 |
+
exports.attempt = require_attempt.attempt;
|
| 7 |
+
exports.attemptAsync = require_attemptAsync.attemptAsync;
|
| 8 |
+
exports.invariant = require_invariant.invariant;
|
node_modules/es-toolkit/dist/util/index.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { attempt } from "./attempt.mjs";
|
| 2 |
+
import { attemptAsync } from "./attemptAsync.mjs";
|
| 3 |
+
import { invariant } from "./invariant.mjs";
|
| 4 |
+
export { invariant as assert, attempt, attemptAsync, invariant };
|
node_modules/es-toolkit/dist/util/invariant.d.mts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/invariant.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Asserts that a given condition is true. If the condition is false, an error is thrown with the provided message.
|
| 4 |
+
*
|
| 5 |
+
* @param condition - The condition to evaluate.
|
| 6 |
+
* @param message - The error message to throw if the condition is false.
|
| 7 |
+
* @returns Returns void if the condition is true.
|
| 8 |
+
* @throws {Error} Throws an error if the condition is false.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* // This call will succeed without any errors
|
| 12 |
+
* invariant(true, 'This should not throw');
|
| 13 |
+
*
|
| 14 |
+
* // This call will fail and throw an error with the message 'This should throw'
|
| 15 |
+
* invariant(false, 'This should throw');
|
| 16 |
+
*/
|
| 17 |
+
declare function invariant(condition: unknown, message: string): asserts condition;
|
| 18 |
+
/**
|
| 19 |
+
* Asserts that a given condition is true. If the condition is false, an error is thrown with the provided error.
|
| 20 |
+
*
|
| 21 |
+
* @param condition - The condition to evaluate.
|
| 22 |
+
* @param error - The error to throw if the condition is false.
|
| 23 |
+
* @returns Returns void if the condition is true.
|
| 24 |
+
* @throws {Error} Throws an error if the condition is false.
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* // This call will succeed without any errors
|
| 28 |
+
* invariant(true, new Error('This should not throw'));
|
| 29 |
+
*
|
| 30 |
+
* class CustomError extends Error {
|
| 31 |
+
* constructor(message: string) {
|
| 32 |
+
* super(message);
|
| 33 |
+
* }
|
| 34 |
+
* }
|
| 35 |
+
*
|
| 36 |
+
* // This call will fail and throw an error with the message 'This should throw'
|
| 37 |
+
* invariant(false, new CustomError('This should throw'));
|
| 38 |
+
*/
|
| 39 |
+
declare function invariant(condition: unknown, error: Error): asserts condition;
|
| 40 |
+
//#endregion
|
| 41 |
+
export { invariant };
|
node_modules/es-toolkit/dist/util/invariant.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/invariant.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Asserts that a given condition is true. If the condition is false, an error is thrown with the provided message.
|
| 4 |
+
*
|
| 5 |
+
* @param condition - The condition to evaluate.
|
| 6 |
+
* @param message - The error message to throw if the condition is false.
|
| 7 |
+
* @returns Returns void if the condition is true.
|
| 8 |
+
* @throws {Error} Throws an error if the condition is false.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* // This call will succeed without any errors
|
| 12 |
+
* invariant(true, 'This should not throw');
|
| 13 |
+
*
|
| 14 |
+
* // This call will fail and throw an error with the message 'This should throw'
|
| 15 |
+
* invariant(false, 'This should throw');
|
| 16 |
+
*/
|
| 17 |
+
declare function invariant(condition: unknown, message: string): asserts condition;
|
| 18 |
+
/**
|
| 19 |
+
* Asserts that a given condition is true. If the condition is false, an error is thrown with the provided error.
|
| 20 |
+
*
|
| 21 |
+
* @param condition - The condition to evaluate.
|
| 22 |
+
* @param error - The error to throw if the condition is false.
|
| 23 |
+
* @returns Returns void if the condition is true.
|
| 24 |
+
* @throws {Error} Throws an error if the condition is false.
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* // This call will succeed without any errors
|
| 28 |
+
* invariant(true, new Error('This should not throw'));
|
| 29 |
+
*
|
| 30 |
+
* class CustomError extends Error {
|
| 31 |
+
* constructor(message: string) {
|
| 32 |
+
* super(message);
|
| 33 |
+
* }
|
| 34 |
+
* }
|
| 35 |
+
*
|
| 36 |
+
* // This call will fail and throw an error with the message 'This should throw'
|
| 37 |
+
* invariant(false, new CustomError('This should throw'));
|
| 38 |
+
*/
|
| 39 |
+
declare function invariant(condition: unknown, error: Error): asserts condition;
|
| 40 |
+
//#endregion
|
| 41 |
+
export { invariant };
|
node_modules/es-toolkit/dist/util/invariant.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/invariant.ts
|
| 2 |
+
/**
|
| 3 |
+
* Asserts that a given condition is true. If the condition is false, an error is thrown with the provided message.
|
| 4 |
+
*
|
| 5 |
+
* @param condition - The condition to evaluate.
|
| 6 |
+
* @param [message] - The error message to throw if the condition is false.
|
| 7 |
+
* @returns Returns void if the condition is true.
|
| 8 |
+
* @throws {Error} Throws an error if the condition is false.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* // This call will succeed without any errors
|
| 12 |
+
* invariant(true, 'This should not throw');
|
| 13 |
+
*
|
| 14 |
+
* // This call will fail and throw an error with the message 'This should throw'
|
| 15 |
+
* invariant(false, 'This should throw');
|
| 16 |
+
*
|
| 17 |
+
* // Example of using invariant with a condition
|
| 18 |
+
* invariant(condition, 'Expected condition is false');
|
| 19 |
+
*
|
| 20 |
+
* // Ensure that the value is neither null nor undefined
|
| 21 |
+
* invariant(value !== null && value !== undefined, 'Value should not be null or undefined');
|
| 22 |
+
*
|
| 23 |
+
* // Example of using invariant to check if a number is positive
|
| 24 |
+
* invariant(number > 0, 'Number must be positive');
|
| 25 |
+
*/
|
| 26 |
+
function invariant(condition, message) {
|
| 27 |
+
if (condition) return;
|
| 28 |
+
if (typeof message === "string") throw new Error(message);
|
| 29 |
+
throw message;
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
exports.invariant = invariant;
|
node_modules/es-toolkit/dist/util/invariant.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/util/invariant.ts
|
| 2 |
+
/**
|
| 3 |
+
* Asserts that a given condition is true. If the condition is false, an error is thrown with the provided message.
|
| 4 |
+
*
|
| 5 |
+
* @param condition - The condition to evaluate.
|
| 6 |
+
* @param [message] - The error message to throw if the condition is false.
|
| 7 |
+
* @returns Returns void if the condition is true.
|
| 8 |
+
* @throws {Error} Throws an error if the condition is false.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* // This call will succeed without any errors
|
| 12 |
+
* invariant(true, 'This should not throw');
|
| 13 |
+
*
|
| 14 |
+
* // This call will fail and throw an error with the message 'This should throw'
|
| 15 |
+
* invariant(false, 'This should throw');
|
| 16 |
+
*
|
| 17 |
+
* // Example of using invariant with a condition
|
| 18 |
+
* invariant(condition, 'Expected condition is false');
|
| 19 |
+
*
|
| 20 |
+
* // Ensure that the value is neither null nor undefined
|
| 21 |
+
* invariant(value !== null && value !== undefined, 'Value should not be null or undefined');
|
| 22 |
+
*
|
| 23 |
+
* // Example of using invariant to check if a number is positive
|
| 24 |
+
* invariant(number > 0, 'Number must be positive');
|
| 25 |
+
*/
|
| 26 |
+
function invariant(condition, message) {
|
| 27 |
+
if (condition) return;
|
| 28 |
+
if (typeof message === "string") throw new Error(message);
|
| 29 |
+
throw message;
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
export { invariant };
|
node_modules/es-toolkit/error.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/error';
|
node_modules/es-toolkit/error.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/error');
|
node_modules/es-toolkit/fp.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/fp';
|
node_modules/es-toolkit/fp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/fp');
|
node_modules/es-toolkit/function.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/function';
|
node_modules/es-toolkit/function.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/function');
|
node_modules/es-toolkit/map.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/map';
|
node_modules/es-toolkit/map.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/map');
|
node_modules/es-toolkit/math.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/math';
|
node_modules/es-toolkit/math.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/math');
|
node_modules/es-toolkit/object.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/object';
|
node_modules/es-toolkit/object.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/object');
|
node_modules/es-toolkit/package.json
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "es-toolkit",
|
| 3 |
+
"version": "1.50.0",
|
| 4 |
+
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
| 5 |
+
"homepage": "https://es-toolkit.dev",
|
| 6 |
+
"bugs": "https://github.com/toss/es-toolkit/issues",
|
| 7 |
+
"repository": {
|
| 8 |
+
"type": "git",
|
| 9 |
+
"url": "https://github.com/toss/es-toolkit.git"
|
| 10 |
+
},
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"sideEffects": false,
|
| 13 |
+
"jsdelivr": "./dist/browser.global.js",
|
| 14 |
+
"unpkg": "./dist/browser.global.js",
|
| 15 |
+
"packageManager": "yarn@4.12.0",
|
| 16 |
+
"exports": {
|
| 17 |
+
".": {
|
| 18 |
+
"import": {
|
| 19 |
+
"types": "./dist/index.d.mts",
|
| 20 |
+
"default": "./dist/index.mjs"
|
| 21 |
+
},
|
| 22 |
+
"require": {
|
| 23 |
+
"types": "./dist/index.d.ts",
|
| 24 |
+
"default": "./dist/index.js"
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
"./array": {
|
| 28 |
+
"import": {
|
| 29 |
+
"types": "./dist/array/index.d.mts",
|
| 30 |
+
"default": "./dist/array/index.mjs"
|
| 31 |
+
},
|
| 32 |
+
"require": {
|
| 33 |
+
"types": "./dist/array/index.d.ts",
|
| 34 |
+
"default": "./dist/array/index.js"
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"./compat": {
|
| 38 |
+
"import": {
|
| 39 |
+
"types": "./dist/compat/index.d.mts",
|
| 40 |
+
"default": "./dist/compat/index.mjs"
|
| 41 |
+
},
|
| 42 |
+
"require": {
|
| 43 |
+
"types": "./dist/compat/index.d.ts",
|
| 44 |
+
"default": "./dist/compat/index.js"
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
"./compat/*": {
|
| 48 |
+
"import": {
|
| 49 |
+
"types": "./compat/*.d.mts",
|
| 50 |
+
"default": "./compat/*.mjs"
|
| 51 |
+
},
|
| 52 |
+
"require": {
|
| 53 |
+
"types": "./compat/*.d.ts",
|
| 54 |
+
"default": "./compat/*.js"
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
"./server": {
|
| 58 |
+
"import": {
|
| 59 |
+
"types": "./dist/server/index.d.mts",
|
| 60 |
+
"default": "./dist/server/index.mjs"
|
| 61 |
+
},
|
| 62 |
+
"require": {
|
| 63 |
+
"types": "./dist/server/index.d.ts",
|
| 64 |
+
"default": "./dist/server/index.js"
|
| 65 |
+
}
|
| 66 |
+
},
|
| 67 |
+
"./error": {
|
| 68 |
+
"import": {
|
| 69 |
+
"types": "./dist/error/index.d.mts",
|
| 70 |
+
"default": "./dist/error/index.mjs"
|
| 71 |
+
},
|
| 72 |
+
"require": {
|
| 73 |
+
"types": "./dist/error/index.d.ts",
|
| 74 |
+
"default": "./dist/error/index.js"
|
| 75 |
+
}
|
| 76 |
+
},
|
| 77 |
+
"./fp": {
|
| 78 |
+
"import": {
|
| 79 |
+
"types": "./dist/fp/index.d.mts",
|
| 80 |
+
"default": "./dist/fp/index.mjs"
|
| 81 |
+
},
|
| 82 |
+
"require": {
|
| 83 |
+
"types": "./dist/fp/index.d.ts",
|
| 84 |
+
"default": "./dist/fp/index.js"
|
| 85 |
+
}
|
| 86 |
+
},
|
| 87 |
+
"./function": {
|
| 88 |
+
"import": {
|
| 89 |
+
"types": "./dist/function/index.d.mts",
|
| 90 |
+
"default": "./dist/function/index.mjs"
|
| 91 |
+
},
|
| 92 |
+
"require": {
|
| 93 |
+
"types": "./dist/function/index.d.ts",
|
| 94 |
+
"default": "./dist/function/index.js"
|
| 95 |
+
}
|
| 96 |
+
},
|
| 97 |
+
"./map": {
|
| 98 |
+
"import": {
|
| 99 |
+
"types": "./dist/map/index.d.mts",
|
| 100 |
+
"default": "./dist/map/index.mjs"
|
| 101 |
+
},
|
| 102 |
+
"require": {
|
| 103 |
+
"types": "./dist/map/index.d.ts",
|
| 104 |
+
"default": "./dist/map/index.js"
|
| 105 |
+
}
|
| 106 |
+
},
|
| 107 |
+
"./math": {
|
| 108 |
+
"import": {
|
| 109 |
+
"types": "./dist/math/index.d.mts",
|
| 110 |
+
"default": "./dist/math/index.mjs"
|
| 111 |
+
},
|
| 112 |
+
"require": {
|
| 113 |
+
"types": "./dist/math/index.d.ts",
|
| 114 |
+
"default": "./dist/math/index.js"
|
| 115 |
+
}
|
| 116 |
+
},
|
| 117 |
+
"./object": {
|
| 118 |
+
"import": {
|
| 119 |
+
"types": "./dist/object/index.d.mts",
|
| 120 |
+
"default": "./dist/object/index.mjs"
|
| 121 |
+
},
|
| 122 |
+
"require": {
|
| 123 |
+
"types": "./dist/object/index.d.ts",
|
| 124 |
+
"default": "./dist/object/index.js"
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
"./predicate": {
|
| 128 |
+
"import": {
|
| 129 |
+
"types": "./dist/predicate/index.d.mts",
|
| 130 |
+
"default": "./dist/predicate/index.mjs"
|
| 131 |
+
},
|
| 132 |
+
"require": {
|
| 133 |
+
"types": "./dist/predicate/index.d.ts",
|
| 134 |
+
"default": "./dist/predicate/index.js"
|
| 135 |
+
}
|
| 136 |
+
},
|
| 137 |
+
"./promise": {
|
| 138 |
+
"import": {
|
| 139 |
+
"types": "./dist/promise/index.d.mts",
|
| 140 |
+
"default": "./dist/promise/index.mjs"
|
| 141 |
+
},
|
| 142 |
+
"require": {
|
| 143 |
+
"types": "./dist/promise/index.d.ts",
|
| 144 |
+
"default": "./dist/promise/index.js"
|
| 145 |
+
}
|
| 146 |
+
},
|
| 147 |
+
"./set": {
|
| 148 |
+
"import": {
|
| 149 |
+
"types": "./dist/set/index.d.mts",
|
| 150 |
+
"default": "./dist/set/index.mjs"
|
| 151 |
+
},
|
| 152 |
+
"require": {
|
| 153 |
+
"types": "./dist/set/index.d.ts",
|
| 154 |
+
"default": "./dist/set/index.js"
|
| 155 |
+
}
|
| 156 |
+
},
|
| 157 |
+
"./string": {
|
| 158 |
+
"import": {
|
| 159 |
+
"types": "./dist/string/index.d.mts",
|
| 160 |
+
"default": "./dist/string/index.mjs"
|
| 161 |
+
},
|
| 162 |
+
"require": {
|
| 163 |
+
"types": "./dist/string/index.d.ts",
|
| 164 |
+
"default": "./dist/string/index.js"
|
| 165 |
+
}
|
| 166 |
+
},
|
| 167 |
+
"./types": {
|
| 168 |
+
"import": {
|
| 169 |
+
"types": "./dist/types/index.d.mts"
|
| 170 |
+
},
|
| 171 |
+
"require": {
|
| 172 |
+
"types": "./dist/types/index.d.ts"
|
| 173 |
+
}
|
| 174 |
+
},
|
| 175 |
+
"./util": {
|
| 176 |
+
"import": {
|
| 177 |
+
"types": "./dist/util/index.d.mts",
|
| 178 |
+
"default": "./dist/util/index.mjs"
|
| 179 |
+
},
|
| 180 |
+
"require": {
|
| 181 |
+
"types": "./dist/util/index.d.ts",
|
| 182 |
+
"default": "./dist/util/index.js"
|
| 183 |
+
}
|
| 184 |
+
},
|
| 185 |
+
"./package.json": "./package.json"
|
| 186 |
+
},
|
| 187 |
+
"files": [
|
| 188 |
+
"dist",
|
| 189 |
+
"compat",
|
| 190 |
+
"*.d.ts",
|
| 191 |
+
"array.js",
|
| 192 |
+
"compat.js",
|
| 193 |
+
"error.js",
|
| 194 |
+
"fp.js",
|
| 195 |
+
"function.js",
|
| 196 |
+
"map.js",
|
| 197 |
+
"math.js",
|
| 198 |
+
"object.js",
|
| 199 |
+
"predicate.js",
|
| 200 |
+
"promise.js",
|
| 201 |
+
"set.js",
|
| 202 |
+
"string.js",
|
| 203 |
+
"server.js",
|
| 204 |
+
"util.js"
|
| 205 |
+
],
|
| 206 |
+
"workspaces": [
|
| 207 |
+
"docs",
|
| 208 |
+
"benchmarks",
|
| 209 |
+
"tests/types"
|
| 210 |
+
],
|
| 211 |
+
"scripts": {
|
| 212 |
+
"bench": "yarn workspace benchmarks bench",
|
| 213 |
+
"build": "tsdown && ./.scripts/postbuild.sh",
|
| 214 |
+
"format": "prettier --write .",
|
| 215 |
+
"gen:benchmark": "node ./.scripts/generate-benchmark.mjs",
|
| 216 |
+
"gen:bundle-size": "node ./.scripts/generate-bundle-size.mjs",
|
| 217 |
+
"lint": "eslint --config eslint.config.mjs --concurrency=auto",
|
| 218 |
+
"packlint": "packlint sort -R",
|
| 219 |
+
"prepack": "yarn build",
|
| 220 |
+
"test": "vitest --coverage",
|
| 221 |
+
"transform": "jscodeshift -t ./.scripts/tests/transform-lodash-test.ts $0 && prettier --write $0",
|
| 222 |
+
"typecheck": "tsc --noEmit"
|
| 223 |
+
},
|
| 224 |
+
"devDependencies": {
|
| 225 |
+
"@arethetypeswrong/cli": "^0.15.3",
|
| 226 |
+
"@changesets/changelog-github": "^0.5.0",
|
| 227 |
+
"@changesets/cli": "^2.27.1",
|
| 228 |
+
"@eslint/js": "^9.39.2",
|
| 229 |
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
| 230 |
+
"@types/broken-link-checker": "0.7.3",
|
| 231 |
+
"@types/jscodeshift": "^0.12.0",
|
| 232 |
+
"@types/node": "^24.10.9",
|
| 233 |
+
"@types/tar": "^6.1.13",
|
| 234 |
+
"@typescript-eslint/parser": "^8.26.1",
|
| 235 |
+
"@vitest/coverage-istanbul": "^4.1.10",
|
| 236 |
+
"@vitest/eslint-plugin": "^1.6.6",
|
| 237 |
+
"@vue/compiler-sfc": "^3.5.10",
|
| 238 |
+
"broken-link-checker": "0.7.8",
|
| 239 |
+
"eslint": "^9.39.2",
|
| 240 |
+
"eslint-config-prettier": "^9.1.0",
|
| 241 |
+
"eslint-plugin-no-for-of-array": "^0.0.1",
|
| 242 |
+
"eslint-plugin-prettier": "^5.2.1",
|
| 243 |
+
"eslint-plugin-vue": "^9.28.0",
|
| 244 |
+
"execa": "^9.3.0",
|
| 245 |
+
"fast-check": "4.8.0",
|
| 246 |
+
"globals": "^15.9.0",
|
| 247 |
+
"happy-dom": "20.9.0",
|
| 248 |
+
"jscodeshift": "^17.0.0",
|
| 249 |
+
"packlint": "^0.2.4",
|
| 250 |
+
"prettier": "^3.2.5",
|
| 251 |
+
"prettier-plugin-sort-re-exports": "^0.1.0",
|
| 252 |
+
"tar": "^6",
|
| 253 |
+
"tsdown": "^0.22.0",
|
| 254 |
+
"tslib": "^2.6.3",
|
| 255 |
+
"tsx": "^4.19.0",
|
| 256 |
+
"typescript": "^5.8.2",
|
| 257 |
+
"typescript-eslint": "^8.6.0",
|
| 258 |
+
"vercel": "^54.4.1",
|
| 259 |
+
"vitest": "^4.1.10"
|
| 260 |
+
},
|
| 261 |
+
"publishConfig": {
|
| 262 |
+
"access": "public",
|
| 263 |
+
"main": "./dist/index.js",
|
| 264 |
+
"module": "./dist/index.mjs",
|
| 265 |
+
"exports": {
|
| 266 |
+
".": {
|
| 267 |
+
"import": {
|
| 268 |
+
"types": "./dist/index.d.mts",
|
| 269 |
+
"default": "./dist/index.mjs"
|
| 270 |
+
},
|
| 271 |
+
"require": {
|
| 272 |
+
"types": "./dist/index.d.ts",
|
| 273 |
+
"default": "./dist/index.js"
|
| 274 |
+
}
|
| 275 |
+
},
|
| 276 |
+
"./array": {
|
| 277 |
+
"import": {
|
| 278 |
+
"types": "./dist/array/index.d.mts",
|
| 279 |
+
"default": "./dist/array/index.mjs"
|
| 280 |
+
},
|
| 281 |
+
"require": {
|
| 282 |
+
"types": "./dist/array/index.d.ts",
|
| 283 |
+
"default": "./dist/array/index.js"
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"./compat": {
|
| 287 |
+
"import": {
|
| 288 |
+
"types": "./dist/compat/index.d.mts",
|
| 289 |
+
"default": "./dist/compat/index.mjs"
|
| 290 |
+
},
|
| 291 |
+
"require": {
|
| 292 |
+
"types": "./dist/compat/index.d.ts",
|
| 293 |
+
"default": "./dist/compat/index.js"
|
| 294 |
+
}
|
| 295 |
+
},
|
| 296 |
+
"./compat/*": {
|
| 297 |
+
"import": {
|
| 298 |
+
"types": "./compat/*.d.mts",
|
| 299 |
+
"default": "./compat/*.mjs"
|
| 300 |
+
},
|
| 301 |
+
"require": {
|
| 302 |
+
"types": "./compat/*.d.ts",
|
| 303 |
+
"default": "./compat/*.js"
|
| 304 |
+
}
|
| 305 |
+
},
|
| 306 |
+
"./server": {
|
| 307 |
+
"import": {
|
| 308 |
+
"types": "./dist/server/index.d.mts",
|
| 309 |
+
"default": "./dist/server/index.mjs"
|
| 310 |
+
},
|
| 311 |
+
"require": {
|
| 312 |
+
"types": "./dist/server/index.d.ts",
|
| 313 |
+
"default": "./dist/server/index.js"
|
| 314 |
+
}
|
| 315 |
+
},
|
| 316 |
+
"./error": {
|
| 317 |
+
"import": {
|
| 318 |
+
"types": "./dist/error/index.d.mts",
|
| 319 |
+
"default": "./dist/error/index.mjs"
|
| 320 |
+
},
|
| 321 |
+
"require": {
|
| 322 |
+
"types": "./dist/error/index.d.ts",
|
| 323 |
+
"default": "./dist/error/index.js"
|
| 324 |
+
}
|
| 325 |
+
},
|
| 326 |
+
"./fp": {
|
| 327 |
+
"import": {
|
| 328 |
+
"types": "./dist/fp/index.d.mts",
|
| 329 |
+
"default": "./dist/fp/index.mjs"
|
| 330 |
+
},
|
| 331 |
+
"require": {
|
| 332 |
+
"types": "./dist/fp/index.d.ts",
|
| 333 |
+
"default": "./dist/fp/index.js"
|
| 334 |
+
}
|
| 335 |
+
},
|
| 336 |
+
"./function": {
|
| 337 |
+
"import": {
|
| 338 |
+
"types": "./dist/function/index.d.mts",
|
| 339 |
+
"default": "./dist/function/index.mjs"
|
| 340 |
+
},
|
| 341 |
+
"require": {
|
| 342 |
+
"types": "./dist/function/index.d.ts",
|
| 343 |
+
"default": "./dist/function/index.js"
|
| 344 |
+
}
|
| 345 |
+
},
|
| 346 |
+
"./map": {
|
| 347 |
+
"import": {
|
| 348 |
+
"types": "./dist/map/index.d.mts",
|
| 349 |
+
"default": "./dist/map/index.mjs"
|
| 350 |
+
},
|
| 351 |
+
"require": {
|
| 352 |
+
"types": "./dist/map/index.d.ts",
|
| 353 |
+
"default": "./dist/map/index.js"
|
| 354 |
+
}
|
| 355 |
+
},
|
| 356 |
+
"./math": {
|
| 357 |
+
"import": {
|
| 358 |
+
"types": "./dist/math/index.d.mts",
|
| 359 |
+
"default": "./dist/math/index.mjs"
|
| 360 |
+
},
|
| 361 |
+
"require": {
|
| 362 |
+
"types": "./dist/math/index.d.ts",
|
| 363 |
+
"default": "./dist/math/index.js"
|
| 364 |
+
}
|
| 365 |
+
},
|
| 366 |
+
"./object": {
|
| 367 |
+
"import": {
|
| 368 |
+
"types": "./dist/object/index.d.mts",
|
| 369 |
+
"default": "./dist/object/index.mjs"
|
| 370 |
+
},
|
| 371 |
+
"require": {
|
| 372 |
+
"types": "./dist/object/index.d.ts",
|
| 373 |
+
"default": "./dist/object/index.js"
|
| 374 |
+
}
|
| 375 |
+
},
|
| 376 |
+
"./predicate": {
|
| 377 |
+
"import": {
|
| 378 |
+
"types": "./dist/predicate/index.d.mts",
|
| 379 |
+
"default": "./dist/predicate/index.mjs"
|
| 380 |
+
},
|
| 381 |
+
"require": {
|
| 382 |
+
"types": "./dist/predicate/index.d.ts",
|
| 383 |
+
"default": "./dist/predicate/index.js"
|
| 384 |
+
}
|
| 385 |
+
},
|
| 386 |
+
"./promise": {
|
| 387 |
+
"import": {
|
| 388 |
+
"types": "./dist/promise/index.d.mts",
|
| 389 |
+
"default": "./dist/promise/index.mjs"
|
| 390 |
+
},
|
| 391 |
+
"require": {
|
| 392 |
+
"types": "./dist/promise/index.d.ts",
|
| 393 |
+
"default": "./dist/promise/index.js"
|
| 394 |
+
}
|
| 395 |
+
},
|
| 396 |
+
"./set": {
|
| 397 |
+
"import": {
|
| 398 |
+
"types": "./dist/set/index.d.mts",
|
| 399 |
+
"default": "./dist/set/index.mjs"
|
| 400 |
+
},
|
| 401 |
+
"require": {
|
| 402 |
+
"types": "./dist/set/index.d.ts",
|
| 403 |
+
"default": "./dist/set/index.js"
|
| 404 |
+
}
|
| 405 |
+
},
|
| 406 |
+
"./string": {
|
| 407 |
+
"import": {
|
| 408 |
+
"types": "./dist/string/index.d.mts",
|
| 409 |
+
"default": "./dist/string/index.mjs"
|
| 410 |
+
},
|
| 411 |
+
"require": {
|
| 412 |
+
"types": "./dist/string/index.d.ts",
|
| 413 |
+
"default": "./dist/string/index.js"
|
| 414 |
+
}
|
| 415 |
+
},
|
| 416 |
+
"./types": {
|
| 417 |
+
"import": {
|
| 418 |
+
"types": "./dist/types/index.d.mts"
|
| 419 |
+
},
|
| 420 |
+
"require": {
|
| 421 |
+
"types": "./dist/types/index.d.ts"
|
| 422 |
+
}
|
| 423 |
+
},
|
| 424 |
+
"./util": {
|
| 425 |
+
"import": {
|
| 426 |
+
"types": "./dist/util/index.d.mts",
|
| 427 |
+
"default": "./dist/util/index.mjs"
|
| 428 |
+
},
|
| 429 |
+
"require": {
|
| 430 |
+
"types": "./dist/util/index.d.ts",
|
| 431 |
+
"default": "./dist/util/index.js"
|
| 432 |
+
}
|
| 433 |
+
},
|
| 434 |
+
"./package.json": "./package.json"
|
| 435 |
+
},
|
| 436 |
+
"types": "./dist/index.d.ts"
|
| 437 |
+
},
|
| 438 |
+
"dependenciesMeta": {
|
| 439 |
+
"@trivago/prettier-plugin-sort-imports@4.3.0": {
|
| 440 |
+
"unplugged": true
|
| 441 |
+
},
|
| 442 |
+
"prettier-plugin-sort-re-exports@0.0.1": {
|
| 443 |
+
"unplugged": true
|
| 444 |
+
},
|
| 445 |
+
"vitepress-plugin-sandpack@1.1.4": {
|
| 446 |
+
"unplugged": true
|
| 447 |
+
}
|
| 448 |
+
},
|
| 449 |
+
"react-native": "./dist/index.js",
|
| 450 |
+
"main": "./dist/index.js",
|
| 451 |
+
"module": "./dist/index.mjs",
|
| 452 |
+
"types": "./dist/index.d.ts"
|
| 453 |
+
}
|
node_modules/es-toolkit/predicate.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/predicate';
|
node_modules/es-toolkit/predicate.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/predicate');
|
node_modules/es-toolkit/promise.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/promise';
|
node_modules/es-toolkit/promise.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/promise');
|
node_modules/es-toolkit/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/server';
|
node_modules/es-toolkit/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/server');
|
node_modules/es-toolkit/set.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/set';
|
node_modules/es-toolkit/set.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/set');
|
node_modules/es-toolkit/src/compat/_internal/Equals.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export type Equals<T, U> = (<X>() => X extends T ? 1 : 2) extends <X>() => X extends U ? 1 : 2 ? true : false;
|
node_modules/es-toolkit/src/compat/_internal/IsWritable.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Equals } from './Equals.d.ts';
|
| 2 |
+
|
| 3 |
+
export type IsWritable<T> = Equals<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>;
|
node_modules/es-toolkit/src/compat/_internal/MutableList.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface MutableList<T> {
|
| 2 |
+
length: number;
|
| 3 |
+
[k: number]: T;
|
| 4 |
+
}
|
node_modules/es-toolkit/src/compat/_internal/RejectReadonly.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { IsWritable } from './IsWritable.d.ts';
|
| 2 |
+
import { MutableList } from './MutableList.d.ts';
|
| 3 |
+
|
| 4 |
+
export type RejectReadonly<T extends MutableList<unknown>> = IsWritable<T> extends true ? T : never;
|
node_modules/es-toolkit/string.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/string';
|
node_modules/es-toolkit/string.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/string');
|
node_modules/es-toolkit/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/types';
|
node_modules/es-toolkit/util.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from './dist/util';
|
node_modules/es-toolkit/util.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
module.exports = require('./dist/util');
|