@devisfuture/mega-collection 2.5.1 → 2.5.3
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 +0 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,29 +155,6 @@ 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
|
-

|
|
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
|
-
|
|
181
158
|
```ts
|
|
182
159
|
import { MergeEngines } from "@devisfuture/mega-collection";
|
|
183
160
|
import { TextSearchEngine } from "@devisfuture/mega-collection/search";
|
package/package.json
CHANGED