@jsonhero/fuzzy-json-search
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -1,2 +0,3 @@ | ||
export { JSONHeroSearch, JSONHeroSearchOptions, JSONHeroPathAccessor } from "./JSONHeroSearch"; | ||
export { JSONHeroSearch, JSONHeroSearchOptions, JSONHeroSearchAccessor, JSONHeroSearchFormatter, } from "./JSONHeroSearch"; | ||
export { search, SearchResult } from "./search"; | ||
export { ItemScore } from "./fuzzyScoring"; |
@@ -1,5 +0,5 @@ | ||
import { JSONHeroPath } from "@jsonhero/path"; | ||
import LRUCache from "lru-cache"; | ||
import { IItemAccessor, ItemScore } from "./fuzzyScoring"; | ||
import { SearchResult } from "./search"; | ||
export declare type JSONHeroSearchFormatter = (value: unknown) => string | undefined; | ||
export declare type JSONHeroSearchOptions = { | ||
@@ -10,24 +10,26 @@ cacheSettings?: { | ||
}; | ||
accessor?: IItemAccessor<string>; | ||
formatter?: JSONHeroSearchFormatter; | ||
}; | ||
export declare class JSONHeroSearch { | ||
json: unknown; | ||
items: JSONHeroPath[]; | ||
accessor: IItemAccessor<JSONHeroPath>; | ||
items: string[]; | ||
scoreCache: Map<number, ItemScore>; | ||
searchCache: LRUCache<string, Array<SearchResult<JSONHeroPath>>>; | ||
options: Required<JSONHeroSearchOptions>; | ||
searchCache: LRUCache<string, Array<SearchResult<string>>>; | ||
options: Required<Omit<JSONHeroSearchOptions, "formatter">>; | ||
constructor(json: unknown, options?: JSONHeroSearchOptions); | ||
prepareIndex(): void; | ||
search(query: string): Array<SearchResult<JSONHeroPath>>; | ||
search(query: string): Array<SearchResult<string>>; | ||
} | ||
export declare class JSONHeroPathAccessor implements IItemAccessor<JSONHeroPath> { | ||
export declare class JSONHeroSearchAccessor implements IItemAccessor<string> { | ||
json: unknown; | ||
formatter: JSONHeroSearchFormatter; | ||
valueCache: Map<string, string>; | ||
constructor(json: unknown); | ||
getIsArrayItem(path: JSONHeroPath): boolean; | ||
getItemLabel(path: JSONHeroPath): string; | ||
getItemDescription(path: JSONHeroPath): string; | ||
getItemPath(path: JSONHeroPath): string; | ||
getRawValue(path: JSONHeroPath): string | undefined; | ||
getFormattedValue(path: JSONHeroPath): string | undefined; | ||
constructor(json: unknown, formatter: JSONHeroSearchFormatter); | ||
getIsArrayItem(path: string): boolean; | ||
getItemLabel(path: string): string; | ||
getItemDescription(path: string): string; | ||
getItemPath(path: string): string; | ||
getRawValue(path: string): string | undefined; | ||
getFormattedValue(path: string): string | undefined; | ||
} |
{ | ||
"name": "@jsonhero/fuzzy-json-search", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "VSCode style fuzzy search for JSON documents", | ||
@@ -27,3 +27,4 @@ "homepage": "https://github.com/jsonhero-io/fuzzy-json-search", | ||
"check-types": "tsc --noEmit", | ||
"test": "jest --coverage", | ||
"test": "jest", | ||
"test:cov": "jest --coverage", | ||
"test:watch": "jest --watchAll", | ||
@@ -50,2 +51,4 @@ "test:badges": "npm t && jest-coverage-badges --output ./badges", | ||
"devDependencies": { | ||
"@jsonhero/path": "^1.0.19", | ||
"@jsonhero/json-infer-types": "^1.2.9", | ||
"@rollup/plugin-node-resolve": "^13.1.2", | ||
@@ -85,6 +88,4 @@ "@types/jest": "^27.0.2", | ||
"dependencies": { | ||
"@jsonhero/json-infer-types": "^1.2.9", | ||
"@jsonhero/path": "^1.0.19", | ||
"lru-cache": "^7.8.1" | ||
} | ||
} |
@@ -39,7 +39,7 @@ # Fuzzy JSON Search | ||
#### Returns `Array<SearchResult<JSONHeroPath>>>` | ||
#### Returns `Array<SearchResult<string>>>` | ||
`SearchResult<JSONHeroPath>` has the following properties: | ||
`SearchResult<string>` has the following properties: | ||
##### `item` is a `JSONHeroPath` representing the path to the key | ||
##### `item` is a `string` representing the path to the key | ||
@@ -46,0 +46,0 @@ ##### `score` is an `ItemScore` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1
3534
162012
19
- Removed@jsonhero/json-infer-types@^1.2.9
- Removed@jsonhero/path@^1.0.19
- Removed@jsonhero/json-infer-types@1.2.11(transitive)
- Removed@jsonhero/path@1.0.21(transitive)
- Removedip-address@8.1.0(transitive)
- Removedjsbn@1.1.0(transitive)
- Removedjson5@2.2.3(transitive)
- Removedjwt-decode@3.1.2(transitive)
- Removedsprintf-js@1.1.2(transitive)
- Removeduuid@8.3.2(transitive)