@devisfuture/mega-collection 2.5.0 → 2.5.1

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.
Files changed (2) hide show
  1. package/README.md +23 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -155,6 +155,29 @@ These fields are used for indexes.
155
155
  Indexes are built lazily on first use inside that shared state, so engine creation stays fast.
156
156
  If you skip `fields`, everything still works, but the engine may scan the full array.
157
157
 
158
+ ### Import
159
+
160
+ This section demonstrates extracting the final result after chained `search`, `sort`, and `filter` calls. Engine methods return an iterable/array-like result that may be evaluated, which enables convenient chaining.
161
+
162
+ It is best practice to convert the final result using `Array.from(...)` into an array before using it in UI or passing it further in your app:
163
+
164
+ ```ts
165
+ const result1 = engine.search("Mia 1210"); // search result
166
+ console.log(Array.from(result1)); // clear array
167
+
168
+ const result2 = engine
169
+ .search("john")
170
+ .sort([{ field: "age", direction: "asc" }])
171
+ .filter([{ field: "city", values: ["Miami", "New York"] }]); // combined result
172
+
173
+ console.log(Array.from(result2)); // clear array
174
+ ```
175
+
176
+ This is an example of result `const result1 = engine.search("Mia 1210");`:
177
+ ![](./data-result.png)
178
+
179
+ The image shows that the result can be a combination of operations from `search`, `sort`, and `filter`. This combined result is intentional for easy method chaining, and you should call `Array.from(...)` on the final result when you need a stable, ready-to-use array.
180
+
158
181
  ```ts
159
182
  import { MergeEngines } from "@devisfuture/mega-collection";
160
183
  import { TextSearchEngine } from "@devisfuture/mega-collection/search";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devisfuture/mega-collection",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "High-performance search, filter & sort engine for 100K+ item collections in JavaScript/TypeScript",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {