Skip to content

Commit 020ad35

Browse files
committed
docs: fix-up some docs
1 parent 4ee9d4d commit 020ad35

File tree

4 files changed

+41
-35
lines changed

4 files changed

+41
-35
lines changed

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Zadeh is a blazing fast library for fuzzy filtering, matching, and other fuzzy t
99
### features
1010

1111
- fuzzy filter through an array of candidates (`StringArrayFilterer`)
12-
- fuzzy filter through a nested tree-like objects (`TreeFilterer`)
12+
- fuzzy filter through nested tree-like objects (`TreeFilterer`)
1313
- Special treatment for strings that have separators (space ` `, hyphen `-`, underline`_`)
1414
- Special treatment for path-like strings (string separated by `\` or `//`)
1515
- give an array of indices at which the query matches the given string (`match`)
@@ -22,7 +22,7 @@ Zadeh is a blazing fast library for fuzzy filtering, matching, and other fuzzy t
2222

2323
## Usage from C++
2424

25-
This is a header only library. Include `./src/zadeh.h` and build it in your application.
25+
This is a header-only library. Include `./src/zadeh.h` and build it in your application.
2626

2727
`examples/example1.cpp`:
2828

@@ -89,7 +89,7 @@ const zadeh = require("zadeh")
8989

9090
### StringArrayFilterer
9191

92-
`StringArrayFilterer` is a class that allows to set the `candidates` only once and perform filtering on them multiple times. This is much more efficient than calling the `filter` function directly.
92+
`StringArrayFilterer` is a class that allows setting the `candidates` only once and perform filtering on them multiple times. This is much more efficient than calling the `filter` function directly.
9393

9494
<details>
9595
<summary>`StringArrayFilterer` API</summary>
@@ -117,12 +117,12 @@ export class StringArrayFilterer {
117117
*
118118
* @param query A string query to match the dataKey of each candidate against.
119119
* @param options Options
120-
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by best match against the query.
120+
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by the best match against the query.
121121
*/
122122
filterIndices(query: string, options: StringArrayFilterOptions = {}): Array<number>
123123

124124
/**
125-
* Allows to set the candidates (if changed or not set in the constructor).
125+
* Allows setting the candidates (if changed or not set in the constructor).
126126
*
127127
* @param candidates An array of strings.
128128
*/
@@ -159,7 +159,7 @@ ObjectArrayFilterer is a class that performs filtering on an array of objects ba
159159
```ts
160160
export class ObjectArrayFilterer<DataKey extends string | number = string> {
161161
/**
162-
* Make a `ObjectArrayFilterer` for the candidates that are going to be filtered.
162+
* Make an `ObjectArrayFilterer` for the candidates that are going to be filtered.
163163
*
164164
* @param candidates An array of objects.
165165
* @param dataKey The key which is indexed for each object, and filtering is done based on the resulting string
@@ -171,7 +171,7 @@ export class ObjectArrayFilterer<DataKey extends string | number = string> {
171171
*
172172
* @param query A string query to match the dataKey of each candidate against.
173173
* @param options Options
174-
* @returns Returns an array of objects sorted by best match against the query.
174+
* @returns Returns an array of objects sorted by the best match against the query.
175175
*/
176176
filter(query: string, options: ObjectArrayFilterOptions = {}): Array<ObjectWithKey>
177177

@@ -180,12 +180,12 @@ export class ObjectArrayFilterer<DataKey extends string | number = string> {
180180
*
181181
* @param query A string query to match each candidate against.
182182
* @param options Options
183-
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by best match against the query.
183+
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by the best match against the query.
184184
*/
185185
filterIndices(query: string, options: StringArrayFilterOptions = {}): Array<number>
186186

187187
/**
188-
* Allows to set the candidates (if changed or not set in the constructor).
188+
* Allows setting the candidates (if changed or not set in the constructor).
189189
*
190190
* @param candidates An array of objects.
191191
* @param dataKey The key which is indexed for each object, and filtering is done based on the resulting string
@@ -218,8 +218,8 @@ objArrFilterer.filter("all") // [{ name: 'Call', id: 1 }]
218218

219219
### TreeFilterer
220220

221-
TreeFilterer is a filters the given query in the nodes of the given array of trees, and returns an array of filtered
222-
trees (or the indices of the filter candidates). A tree object is an object in which each entry stores the data in its `dataKey` and it has (may have) some
221+
TreeFilterer filters the given query in the nodes of the given array of trees and returns an array of filtered
222+
trees (or the indices of the filter candidates). A tree object is an object in which each entry stores the data in its `dataKey`, and it has (may have) some
223223
children (with a similar structure) in its `childrenKey`
224224

225225
<details>
@@ -259,7 +259,7 @@ export class TreeFilterer<DataKey extends string, ChildrenKey extends string> {
259259
* @param query A string query to match the dataKey of each candidate against.
260260
* @param options Options
261261
* @returns {Tree[]} An array of filtered trees. In a tree, the filtered data is at the last level (if it has
262-
* children, they are not included in the filered tree)
262+
* children, they are not included in the filtered tree)
263263
*/
264264
filter(query: string, options: TreeFilterOptions = {}): Tree<DataKey, ChildrenKey>[]
265265

@@ -269,7 +269,7 @@ export class TreeFilterer<DataKey extends string, ChildrenKey extends string> {
269269
* @param query A string query to match the dataKey of each candidate against.
270270
* @param options Options
271271
* @returns {TreeFilterIndicesResult[]} An array candidate objects in form of `{data, index, parentIndices}` sorted by
272-
* best match against the query. Each objects has the address of the object in the tree using `index` and `parent_indices`
272+
* best match against the query. Each object has the address of the object in the tree using `index` and `parent_indices`
273273
*/
274274
filterIndices(query: string, options: TreeFilterOptions = {}): TreeFilterIndicesResult[]
275275
}
@@ -445,7 +445,7 @@ const candidates = [
445445
results = filter(candidates, "me", { key: "name" }) // [{name: 'Me', id: 2}, {name: 'Maybe', id: 3}]
446446
```
447447

448-
**Deprecation Note**: use `StringArrayFilterer` or `ObjectArrayFilterer` class instead. `filter` internally uses this class and in each call, it sets the candidates from scratch which can slow down the process.
448+
**Deprecation Note**: use `StringArrayFilterer` or `ObjectArrayFilterer` class instead. `filter` internally uses this class, and in each call, it sets the candidates from scratch, which can slow down the process.
449449

450450
</details>
451451

@@ -457,9 +457,9 @@ API is backward compatible with Fuzzaldrin and Fuzzaldrin-plus. Additional funct
457457

458458
Zadeh achieves 10x-20x performance improvement over Fuzzaldrin plus for chromium project with 300K files. This high performance is achieved using the following techniques.
459459

460-
- Uses native C++ bindings that provides `~4x` performance benefit.
460+
- Uses native C++ bindings that provide `~4x` performance benefit.
461461
- Use multiple threads to parallelize computation to achieve another `~4x` performance benefit.
462-
- Some miscellaneous improvements provide additional benefit.
462+
- Some miscellaneous improvements provide additional benefits.
463463

464464
This project potentially solves the following Atom fuzzy-finder issues if used.
465465
https://github.com/atom/fuzzy-finder/issues/271 and https://github.com/atom/fuzzy-finder/issues/88

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"jasmine": "^3.9.0",
5959
"parcel": "2.0.0-rc.0",
6060
"prebuildify": "^4.2.0",
61-
"prettier-config-atomic": "^2.0.5",
61+
"prettier-config-atomic": "^2.0.6",
6262
"shx": "^0.3.3",
6363
"terser-config-atomic": "^0.1.1",
6464
"typescript": "^4.4.3"

pnpm-lock.yaml

+15-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/binding/index.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class StringArrayFilterer {
143143
*
144144
* @param query A string query to match each candidate against.
145145
* @param options Options
146-
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by best match against the query.
146+
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by the best match against the query.
147147
*/
148148
filterIndices(query: string, options: StringArrayFilterOptions = {}): Array<number> {
149149
parseFilterOptions(options)
@@ -169,7 +169,7 @@ export class ObjectArrayFilterer<DataKey extends string | number = string> {
169169
private candidates: ObjectWithKey<DataKey>[]
170170

171171
/**
172-
* Make a `ObjectArrayFilterer` for the candidates that are going to be filtered.
172+
* Make an `ObjectArrayFilterer` for the candidates that are going to be filtered.
173173
*
174174
* @param candidates An array of objects.
175175
* @param dataKey The key which is indexed for each object, and filtering is done based on the resulting string
@@ -183,7 +183,7 @@ export class ObjectArrayFilterer<DataKey extends string | number = string> {
183183
}
184184

185185
/**
186-
* Allows to set the candidates (if changed or not set in the constructor).
186+
* Allows setting the candidates (if changed or not set in the constructor).
187187
*
188188
* @param candidates An array of objects.
189189
* @param dataKey The key which is indexed for each object, and filtering is done based on the resulting string
@@ -212,7 +212,7 @@ export class ObjectArrayFilterer<DataKey extends string | number = string> {
212212
*
213213
* @param query A string query to match the dataKey of each candidate against.
214214
* @param options Options
215-
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by best match against the query.
215+
* @returns Returns an array of numbers indicating the index of the chosen candidate sorted by the best match against the query.
216216
*/
217217
filterIndices(query: string, options: StringArrayFilterOptions = {}): Array<number> {
218218
parseFilterOptions(options)
@@ -297,9 +297,9 @@ export interface TreeFilterIndicesResult {
297297
}
298298

299299
/**
300-
* TreeFilterer is a filters the given query in the nodes of the given array of trees, and returns an array of filtered
301-
* tree. A tree object is an object in which each entry stores the data in its dataKey and it has (may have) some
302-
* children (with a similar structure) in its childrenKey
300+
* TreeFilterer filters the given query in the nodes of the given array of trees and returns an array of filtered trees
301+
* (or the indices of the filter candidates). A tree object is an object in which each entry stores the data in its
302+
* `dataKey`, and it has (may have) some children (with a similar structure) in its `childrenKey`
303303
*/
304304
export class TreeFilterer<DataKey extends string = string, ChildrenKey extends string = string> {
305305
obj = new binding.Zadeh()
@@ -350,7 +350,7 @@ export class TreeFilterer<DataKey extends string = string, ChildrenKey extends s
350350
* @param query A string query to match the dataKey of each candidate against.
351351
* @param options Options
352352
* @returns {Tree[]} An array of filtered trees. In a tree, the filtered data is at the last level (if it has
353-
* children, they are not included in the filered tree)
353+
* children, they are not included in the filtered tree)
354354
*/
355355
filter(query: string, options: TreeFilterOptions = {}): Tree<DataKey, ChildrenKey>[] {
356356
parseFilterOptions(options)
@@ -373,7 +373,7 @@ export class TreeFilterer<DataKey extends string = string, ChildrenKey extends s
373373
* @param query A string query to match the dataKey of each candidate against.
374374
* @param options Options
375375
* @returns {TreeFilterIndicesResult[]} An array candidate objects in form of `{data, index, parentIndices}` sorted by
376-
* best match against the query. Each objects has the address of the object in the tree using `index` and `parent_indices`
376+
* best match against the query. Each object has the address of the object in the tree using `index` and `parent_indices`
377377
*/
378378
filterIndices(query: string, options: TreeFilterOptions = {}): TreeFilterIndicesResult[] {
379379
parseOptions(options)

0 commit comments

Comments
 (0)