@medyll/idae-engine 1.119.1 → 1.121.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.
- package/README.md +121 -121
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
# @medyll/engine
|
|
2
|
-
|
|
3
|
-
The main base scripts for idae based modules.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Install the package using npm:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @medyll/idae-engine
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or using yarn:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
yarn add @medyll/idae-engine
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
The `@medyll/idae-eengine` package contains several utility classes. This section focuses on the `dataOp` class, which provides various data manipulation methods.
|
|
22
|
-
|
|
23
|
-
### Importing
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import { dataOp } from '@medyll/idae-engine';
|
|
27
|
-
```
|
|
28
|
-
## dataOp
|
|
29
|
-
### Methods
|
|
30
|
-
|
|
31
|
-
#### do
|
|
32
|
-
|
|
33
|
-
Performs a combination of sort, find, and group operations on data.
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
const result = dataOp.do({
|
|
37
|
-
sort: { arr: myArray, by: 'fieldName', sort: 'asc' },
|
|
38
|
-
find: { arr: myArray, kw: 'searchTerm', field: 'fieldName' },
|
|
39
|
-
group: { dataList: myArray, groupBy: 'fieldName' }
|
|
40
|
-
});
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### sortBy
|
|
44
|
-
|
|
45
|
-
Sorts an array of objects based on specified fields.
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
const sortedArray = dataOp.sortBy({
|
|
49
|
-
arr: myArray,
|
|
50
|
-
by: 'fieldName',
|
|
51
|
-
sort: 'asc'
|
|
52
|
-
});
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
#### find
|
|
56
|
-
|
|
57
|
-
Searches for objects in an array based on specified criteria.
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
const foundItems = dataOp.find({
|
|
61
|
-
arr: myArray,
|
|
62
|
-
kw: 'searchTerm',
|
|
63
|
-
field: 'fieldName'
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### findOne
|
|
68
|
-
|
|
69
|
-
Searches for the first object in an array that matches the specified criteria.
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
const foundItem = dataOp.findOne({
|
|
73
|
-
arr: myArray,
|
|
74
|
-
kw: 'searchTerm',
|
|
75
|
-
field: 'fieldName'
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
#### groupBy
|
|
80
|
-
|
|
81
|
-
Groups objects in an array based on specified fields or a custom grouping function.
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
const groupedData = dataOp.groupBy({
|
|
85
|
-
dataList: myArray,
|
|
86
|
-
groupBy: 'fieldName'
|
|
87
|
-
});
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
#### findByIndex
|
|
91
|
-
|
|
92
|
-
Finds the index of an object in an array based on a specified key-value pair.
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
const index = dataOp.findByIndex(myArray, 'value', 'keyName');
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### resolveDotPath
|
|
99
|
-
|
|
100
|
-
Resolves a dot-notated path in an object.
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
const value = dataOp.resolveDotPath(myObject, 'path.to.property');
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Testing
|
|
107
|
-
|
|
108
|
-
The `dataOp` class comes with a comprehensive test suite. To run the tests:
|
|
109
|
-
|
|
110
|
-
1. Clone the repository
|
|
111
|
-
2. Install dependencies: `npm install` or `yarn install`
|
|
112
|
-
3. Run tests: `npm test` or `yarn test`
|
|
113
|
-
|
|
114
|
-
The tests cover various scenarios for each method, ensuring the reliability and correctness of the `dataOp` class.
|
|
115
|
-
|
|
116
|
-
## Contributing
|
|
117
|
-
|
|
118
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
119
|
-
|
|
120
|
-
## License
|
|
121
|
-
|
|
1
|
+
# @medyll/engine
|
|
2
|
+
|
|
3
|
+
The main base scripts for idae based modules.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the package using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @medyll/idae-engine
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or using yarn:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @medyll/idae-engine
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
The `@medyll/idae-eengine` package contains several utility classes. This section focuses on the `dataOp` class, which provides various data manipulation methods.
|
|
22
|
+
|
|
23
|
+
### Importing
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { dataOp } from '@medyll/idae-engine';
|
|
27
|
+
```
|
|
28
|
+
## dataOp
|
|
29
|
+
### Methods
|
|
30
|
+
|
|
31
|
+
#### do
|
|
32
|
+
|
|
33
|
+
Performs a combination of sort, find, and group operations on data.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
const result = dataOp.do({
|
|
37
|
+
sort: { arr: myArray, by: 'fieldName', sort: 'asc' },
|
|
38
|
+
find: { arr: myArray, kw: 'searchTerm', field: 'fieldName' },
|
|
39
|
+
group: { dataList: myArray, groupBy: 'fieldName' }
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### sortBy
|
|
44
|
+
|
|
45
|
+
Sorts an array of objects based on specified fields.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const sortedArray = dataOp.sortBy({
|
|
49
|
+
arr: myArray,
|
|
50
|
+
by: 'fieldName',
|
|
51
|
+
sort: 'asc'
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### find
|
|
56
|
+
|
|
57
|
+
Searches for objects in an array based on specified criteria.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
const foundItems = dataOp.find({
|
|
61
|
+
arr: myArray,
|
|
62
|
+
kw: 'searchTerm',
|
|
63
|
+
field: 'fieldName'
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### findOne
|
|
68
|
+
|
|
69
|
+
Searches for the first object in an array that matches the specified criteria.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const foundItem = dataOp.findOne({
|
|
73
|
+
arr: myArray,
|
|
74
|
+
kw: 'searchTerm',
|
|
75
|
+
field: 'fieldName'
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### groupBy
|
|
80
|
+
|
|
81
|
+
Groups objects in an array based on specified fields or a custom grouping function.
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const groupedData = dataOp.groupBy({
|
|
85
|
+
dataList: myArray,
|
|
86
|
+
groupBy: 'fieldName'
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### findByIndex
|
|
91
|
+
|
|
92
|
+
Finds the index of an object in an array based on a specified key-value pair.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
const index = dataOp.findByIndex(myArray, 'value', 'keyName');
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### resolveDotPath
|
|
99
|
+
|
|
100
|
+
Resolves a dot-notated path in an object.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const value = dataOp.resolveDotPath(myObject, 'path.to.property');
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Testing
|
|
107
|
+
|
|
108
|
+
The `dataOp` class comes with a comprehensive test suite. To run the tests:
|
|
109
|
+
|
|
110
|
+
1. Clone the repository
|
|
111
|
+
2. Install dependencies: `npm install` or `yarn install`
|
|
112
|
+
3. Run tests: `npm test` or `yarn test`
|
|
113
|
+
|
|
114
|
+
The tests cover various scenarios for each method, ensuring the reliability and correctness of the `dataOp` class.
|
|
115
|
+
|
|
116
|
+
## Contributing
|
|
117
|
+
|
|
118
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
122
|
This project is licensed under the MIT License.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medyll/idae-engine",
|
|
3
3
|
"scope": "@medyll",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.121.0",
|
|
5
5
|
"description": "A powerful TypeScript library for data manipulation and operations across the idae-engine. Provides utility classes for sorting, finding, grouping, and more.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|