@purr-react-core/utils.definitions 0.0.14
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/LICENSE +21 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +0 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Dinh Thien Phuc
|
|
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/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A type alias for `any`. This type can represent any value.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Use this type with caution as it disables type checking for the value it is assigned to.
|
|
6
|
+
*/
|
|
7
|
+
type TAny = any;
|
|
8
|
+
/**
|
|
9
|
+
* A type representing a function that iterates over an array.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The type of elements in the array.
|
|
12
|
+
* @param value - The current element being processed in the array.
|
|
13
|
+
* @param index - The index of the current element being processed in the array.
|
|
14
|
+
* @param array - The array that `TIterator` is iterating over.
|
|
15
|
+
* @returns An unknown value.
|
|
16
|
+
*/
|
|
17
|
+
type TIterator = <T>(value: T, index?: number, array?: T[]) => unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Represents the boundary of an asynchronous operation, encapsulating both the result and any potential error.
|
|
20
|
+
*
|
|
21
|
+
* @template T - The type of the result.
|
|
22
|
+
* @property {unknown | null} error - The error encountered during the asynchronous operation, if any.
|
|
23
|
+
* @property {T | null} result - The result of the asynchronous operation, if successful.
|
|
24
|
+
*/
|
|
25
|
+
type TAsyncBoundary<T> = {
|
|
26
|
+
error: unknown | null;
|
|
27
|
+
result: Awaited<T> | null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents an extendable object where keys are strings and values can be of any type.
|
|
32
|
+
*
|
|
33
|
+
* @interface IExtendable
|
|
34
|
+
* @template TAny - The type of the values in the extendable object.
|
|
35
|
+
*/
|
|
36
|
+
interface IExtendable {
|
|
37
|
+
[key: string]: TAny;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type { IExtendable, TAny, TAsyncBoundary, TIterator };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A type alias for `any`. This type can represent any value.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Use this type with caution as it disables type checking for the value it is assigned to.
|
|
6
|
+
*/
|
|
7
|
+
type TAny = any;
|
|
8
|
+
/**
|
|
9
|
+
* A type representing a function that iterates over an array.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The type of elements in the array.
|
|
12
|
+
* @param value - The current element being processed in the array.
|
|
13
|
+
* @param index - The index of the current element being processed in the array.
|
|
14
|
+
* @param array - The array that `TIterator` is iterating over.
|
|
15
|
+
* @returns An unknown value.
|
|
16
|
+
*/
|
|
17
|
+
type TIterator = <T>(value: T, index?: number, array?: T[]) => unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Represents the boundary of an asynchronous operation, encapsulating both the result and any potential error.
|
|
20
|
+
*
|
|
21
|
+
* @template T - The type of the result.
|
|
22
|
+
* @property {unknown | null} error - The error encountered during the asynchronous operation, if any.
|
|
23
|
+
* @property {T | null} result - The result of the asynchronous operation, if successful.
|
|
24
|
+
*/
|
|
25
|
+
type TAsyncBoundary<T> = {
|
|
26
|
+
error: unknown | null;
|
|
27
|
+
result: Awaited<T> | null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents an extendable object where keys are strings and values can be of any type.
|
|
32
|
+
*
|
|
33
|
+
* @interface IExtendable
|
|
34
|
+
* @template TAny - The type of the values in the extendable object.
|
|
35
|
+
*/
|
|
36
|
+
interface IExtendable {
|
|
37
|
+
[key: string]: TAny;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type { IExtendable, TAny, TAsyncBoundary, TIterator };
|
package/dist/index.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purr-react-core/utils.definitions",
|
|
3
|
+
"version": "0.0.14",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
25
|
+
},
|
|
26
|
+
"author": "@DinhThienPhuc",
|
|
27
|
+
"license": "ISC",
|
|
28
|
+
"description": "",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"scripts": {
|
|
31
|
+
"dev": "vite build --watch",
|
|
32
|
+
"build": "tsc && vite build",
|
|
33
|
+
"build:vite": "tsc && vite build",
|
|
34
|
+
"build:tsup": "tsup",
|
|
35
|
+
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
36
|
+
}
|
|
37
|
+
}
|