@devisfuture/mega-collection 1.1.2 → 1.1.4
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 +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
What does this package solve?
|
|
12
12
|
|
|
13
|
-
Sometimes in projects, you need to iterate through huge collections (
|
|
13
|
+
Sometimes in projects, you need to iterate through huge collections (100K+ elements in an array) that have come from the server. Usually, the most common features are searching, filtering, and sorting.
|
|
14
14
|
So, this package helps to perform searching, filtering, and sorting of large collections faster than standard JavaScript methods. This operation is performed before rendering the UI content.
|
|
15
15
|
|
|
16
16
|
Zero dependencies. Tree-shakeable. Import only what you need.
|
|
@@ -83,7 +83,7 @@ const engine = new MergeEngines<User>({
|
|
|
83
83
|
// dataset is passed once at init — no need to repeat it in every call
|
|
84
84
|
engine.search("john");
|
|
85
85
|
engine.sort([{ field: "age", direction: "asc" }]);
|
|
86
|
-
engine.filter([{ field: "city", values: ["
|
|
86
|
+
engine.filter([{ field: "city", values: ["Miami", "New York"] }]);
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
---
|
|
@@ -130,13 +130,13 @@ const engine = new FilterEngine<User>({
|
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
engine.filter([
|
|
133
|
-
{ field: "city", values: ["
|
|
133
|
+
{ field: "city", values: ["Miami", "New York"] },
|
|
134
134
|
{ field: "age", values: [25, 30, 35] },
|
|
135
135
|
]);
|
|
136
136
|
|
|
137
137
|
// Sequential mode example:
|
|
138
138
|
// 1) First call filters by city
|
|
139
|
-
const byCity = engine.filter([{ field: "city", values: ["
|
|
139
|
+
const byCity = engine.filter([{ field: "city", values: ["Miami"] }]);
|
|
140
140
|
// 2) Second call filters only inside previous result
|
|
141
141
|
const byCityAndAge = engine.filter([{ field: "age", values: [22] }]);
|
|
142
142
|
```
|