@ts-utilities/core 1.0.5 → 1.0.7
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/README.md +15 -15
- package/dist/index.cjs +1 -784
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +1 -765
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# @ts-
|
|
1
|
+
# @ts-collection/core
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|

|
|
6
|
-

|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
9
|
|
|
10
|
-
`@ts-
|
|
10
|
+
`@ts-collection/core` is a collection of core utility functions and advanced TypeScript types designed for JavaScript/TypeScript projects. It provides essential utilities for object manipulation, async operations, data transformation, and type-level programming. The library is built with TypeScript and is fully typed, ensuring a smooth and error-free development experience.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
|
-
You can install `@ts-
|
|
23
|
+
You can install `@ts-collection/core` using npm or yarn:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install @ts-
|
|
26
|
+
npm install @ts-collection/core
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
or
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
yarn add @ts-
|
|
32
|
+
yarn add @ts-collection/core
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Usage
|
|
@@ -39,9 +39,9 @@ yarn add @ts-utilities/core
|
|
|
39
39
|
You can import individual utilities or types as needed:
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
import { deepmerge, poll, shield, sleep, debounce, throttle } from '@ts-
|
|
43
|
-
import { getObjectValue, extendProps, hydrate } from '@ts-
|
|
44
|
-
import type { DeepPartial, Primitive, KeysOfType } from '@ts-
|
|
42
|
+
import { deepmerge, poll, shield, sleep, debounce, throttle } from '@ts-collection/core';
|
|
43
|
+
import { getObjectValue, extendProps, hydrate } from '@ts-collection/core/functions';
|
|
44
|
+
import type { DeepPartial, Primitive, KeysOfType } from '@ts-collection/core/types';
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Examples
|
|
@@ -49,7 +49,7 @@ import type { DeepPartial, Primitive, KeysOfType } from '@ts-utilities/core/type
|
|
|
49
49
|
#### Object Utilities
|
|
50
50
|
|
|
51
51
|
```typescript
|
|
52
|
-
import { getObjectValue, extendProps } from '@ts-
|
|
52
|
+
import { getObjectValue, extendProps } from '@ts-collection/core';
|
|
53
53
|
|
|
54
54
|
const obj = { a: { b: { c: 1 } } };
|
|
55
55
|
const value = getObjectValue(obj, 'a.b.c'); // 1
|
|
@@ -60,7 +60,7 @@ const extended = extendProps({ a: 1 }, { b: 'hello' }); // { a: 1, b: 'hello' }
|
|
|
60
60
|
#### Data Transformation
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
|
-
import { hydrate, deepmerge } from '@ts-
|
|
63
|
+
import { hydrate, deepmerge } from '@ts-collection/core';
|
|
64
64
|
|
|
65
65
|
const cleaned = hydrate({ a: null, b: { c: null } }); // { a: undefined, b: { c: undefined } }
|
|
66
66
|
|
|
@@ -95,7 +95,7 @@ const combined = deepmerge(
|
|
|
95
95
|
#### Async Operations
|
|
96
96
|
|
|
97
97
|
```typescript
|
|
98
|
-
import { poll, shield, sleep } from '@ts-
|
|
98
|
+
import { poll, shield, sleep } from '@ts-collection/core';
|
|
99
99
|
|
|
100
100
|
const result = await poll(async () => {
|
|
101
101
|
const status = await checkStatus();
|
|
@@ -108,7 +108,7 @@ const [error, data] = await shield(fetchData());
|
|
|
108
108
|
#### Debounce and Throttle
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
|
-
import { debounce, throttle } from '@ts-
|
|
111
|
+
import { debounce, throttle } from '@ts-collection/core';
|
|
112
112
|
|
|
113
113
|
const debouncedFunction = debounce(() => console.log('Debounced!'), 300);
|
|
114
114
|
const throttledFunction = throttle(() => console.log('Throttled!'), 300);
|
|
@@ -117,7 +117,7 @@ const throttledFunction = throttle(() => console.log('Throttled!'), 300);
|
|
|
117
117
|
#### TypeScript Types
|
|
118
118
|
|
|
119
119
|
```typescript
|
|
120
|
-
import type { DeepPartial, Nullable, KeysOfType, Primitive } from '@ts-
|
|
120
|
+
import type { DeepPartial, Nullable, KeysOfType, Primitive } from '@ts-collection/core/types';
|
|
121
121
|
|
|
122
122
|
type PartialUser = DeepPartial<User>;
|
|
123
123
|
type NullableUser = Nullable<User>;
|
|
@@ -279,4 +279,4 @@ This project is licensed under the ISC License - see the [LICENSE](LICENSE) file
|
|
|
279
279
|
## Contact
|
|
280
280
|
|
|
281
281
|
- **Sohan Emon**: [sohanemon@outlook.com](mailto:sohanemon@outlook.com)
|
|
282
|
-
- **GitHub**: [
|
|
282
|
+
- **GitHub**: [ts-collection/core](https://github.com/ts-collection/core)
|