Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit680d24c

Browse files
committed
chore: tweak docs and remove logs
1 parent29832d7 commit680d24c

File tree

5 files changed

+33
-11
lines changed

5 files changed

+33
-11
lines changed

‎README.md‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ console.log("RESULTS", results);
5353

5454
The`search` API gives approximate matched strings with the passed query in the below format.
5555

56+
| Attributes| Description|
57+
| ----| ----|
58+
| text | The target string against which query is matched
59+
| distance | The minimum number of edits (Instertion / Deletion / Replacement) required to transform the query to target text.
60+
5661
```js
5762
[
5863
{
@@ -106,12 +111,31 @@ The `search` API gives approximate matched strings with the passed query in the
106111
];
107112
```
108113

114+
109115
##Options
110116

111117
###`includeMatches`
112118

113-
`includeMatches` - Determines whether the`indices` at which characters matche should be returned in the response.
119+
`includeMatches` - Determines whether the`indices` at which characters matche should be returned in the response. Each`match` element consists of two indices -
120+
1. The index of query string where match is found.
121+
2. The index of target string where a match is found.
122+
123+
Example:point_down:
124+
125+
```js
126+
query="ala", target string="Australia"
127+
matches: [
128+
[0,5],
129+
[1,6],
130+
[2,8],
131+
],
132+
```
133+
In the above example:point_down: matches are found
134+
1. character`a` at`0th` index in`ala` matches with characater`a` at`5th` index in`Australia`
135+
2. character`l` at`1st` index in`ala` matches with characater`a` at`6th` index in`Australia`
136+
3. character`a` at`2nd` index in`ala` matches with characater`a` at`8th` index in`Australia`
114137

138+
The complete response would be:point_down:
115139
```js
116140
[
117141
{
@@ -226,4 +250,4 @@ yarn build
226250

227251
##Contributing
228252

229-
Please open an[issue](https://github.com/ad1992/fuzzify/issues) so we can start discussing. Any help to improve the library is welcome :).
253+
Please open an[issue](https://github.com/ad1992/fuzzify/issues) so we can start discussing. Any help to improve the library ismostwelcome :).

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"fuzzify",
3-
"version":"0.1.0-test3",
3+
"version":"0.1.0",
44
"description":"A lightweight fuzzy search library",
55
"main":"dist/index.js",
66
"types":"dist/index.d.ts",
@@ -30,7 +30,7 @@
3030
},
3131
"homepage":"https://github.com/ad1992/fuzzify#readme",
3232
"devDependencies": {
33-
"fuzzify":"^0.1.0-test3",
33+
"fuzzify":"^0.1.0-test4",
3434
"ts-node":"^10.9.2",
3535
"typescript":"^5.5.3",
3636
"vite":"^5.3.4"

‎playground/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function performSearch() {
88
.value!.toLowerCase();
99
constfuzzy=newFuzzy(countries,{includeMatches:true});
1010
constresults=fuzzy.search(query);
11+
console.debug("RESULTS = ",results);
1112
displayResults(results);
1213
}
1314

‎src/index.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ class Fuzzy {
5858
letj=str2.length;
5959

6060
while(i>0&&j>0){
61-
console.log(str1[i-1],str2[j-1]);
62-
console.log(matrix[i-1][j],matrix[i][j-1]);
6361
if(str1[i-1]===str2[j-1]){
6462
matches.unshift([i-1,j-1]);
6563
i--;
@@ -120,7 +118,6 @@ class Fuzzy {
120118
});
121119

122120
constapproxMatches:Result=[];
123-
console.debug("RESULTS = ",result);
124121
result.forEach((res,index)=>{
125122
constobj:SingleResult={text:res.text,distance:res.distance};
126123
if(res.score>0){

‎yarn.lock‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ fsevents@~2.3.2, fsevents@~2.3.3:
308308
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
309309
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
310310

311-
fuzzify@^0.1.0-test3:
312-
version "0.1.0-test3"
313-
resolved "https://registry.yarnpkg.com/fuzzify/-/fuzzify-0.1.0-test3.tgz#bffc71fa870cbddc3cbb76c2bcfdf38f9eceb805"
314-
integrity sha512-MCX+sv8aaW85wEOlwgxLIyMAP8jZeSs16yNO1geLHmdriQJZEZNEtCRrN/1XCKCa6QZ745V48QU9MHoXz5s3ig==
311+
fuzzify@^0.1.0-test4:
312+
version "0.1.0-test4"
313+
resolved "https://registry.yarnpkg.com/fuzzify/-/fuzzify-0.1.0-test4.tgz#074c147f37c1fe33c72ca647327f03ada161d1c0"
314+
integrity sha512-PLDGJdJM1Fu/JLjBZLF/JiCzyKjaQk7UkzCOUH8gocTFZKQK9+WWzesEf0cG4njoOtQoH1lxAoqHQeyccKKuDA==
315315

316316
make-error@^1.1.1:
317317
version "1.3.6"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp