Skip to content

Commit bf42e4d

Browse files
committed
JSONHeroSearch now uses string paths instead of JSONHeroPath and now allows customizing formattedValue
1 parent c2bdff4 commit bf42e4d

File tree

9 files changed

+242
-308
lines changed

9 files changed

+242
-308
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const results = searcher.search("user");
3636

3737
Performs a fuzzy search against the entire document, ordering by score. Will only return results that score more than 0.
3838

39-
#### Returns `Array<SearchResult<JSONHeroPath>>>`
39+
#### Returns `Array<SearchResult<string>>>`
4040

41-
`SearchResult<JSONHeroPath>` has the following properties:
41+
`SearchResult<string>` has the following properties:
4242

43-
##### `item` is a `JSONHeroPath` representing the path to the key
43+
##### `item` is a `string` representing the path to the key
4444

4545
##### `score` is an `ItemScore`
4646

package-lock.json

Lines changed: 28 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"scripts": {
2525
"clean": "rimraf lib",
2626
"check-types": "tsc --noEmit",
27-
"test": "jest --coverage",
27+
"test": "jest",
28+
"test:cov": "jest --coverage",
2829
"test:watch": "jest --watchAll",
2930
"test:badges": "npm t && jest-coverage-badges --output ./badges",
3031
"build": "rollup -c",
@@ -46,6 +47,8 @@
4647
"author": "Eric Allam",
4748
"license": "MIT",
4849
"devDependencies": {
50+
"@jsonhero/path": "^1.0.19",
51+
"@jsonhero/json-infer-types": "^1.2.9",
4952
"@rollup/plugin-node-resolve": "^13.1.2",
5053
"@types/jest": "^27.0.2",
5154
"@types/lru-cache": "^7.6.1",
@@ -80,8 +83,6 @@
8083
}
8184
},
8285
"dependencies": {
83-
"@jsonhero/json-infer-types": "^1.2.9",
84-
"@jsonhero/path": "^1.0.19",
8586
"lru-cache": "^7.8.1"
8687
}
8788
}

profile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,6 @@ const json = {
10041004
const searcher = new JSONHeroSearch(json, { cacheSettings: { enabled: false } });
10051005
searcher.prepareIndex();
10061006

1007-
for (let i = 0; i < 100; i++) {
1007+
for (let i = 0; i < 10; i++) {
10081008
searcher.search("url");
10091009
}

0 commit comments

Comments
 (0)