Skip to content

Commit

Permalink
Merge branch 'master' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
krisk authored May 6, 2022
2 parents 4acabb6 + b886850 commit da6e399
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
stale-issue-message: 'This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days'
days-before-stale: 120
days-before-close: 30
15 changes: 8 additions & 7 deletions dist/fuse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ declare class Fuse<T> {
* @returns An indexed list
*/
static createIndex<U>(
keys: Array<Fuse.FuseOptionKey>,
keys: Array<Fuse.FuseOptionKey<U>>,
list: ReadonlyArray<U>,
options?: Fuse.FuseIndexOptions<U>
): Fuse.FuseIndex<U>
Expand Down Expand Up @@ -234,12 +234,13 @@ declare namespace Fuse {
// name: 'title',
// weight: 0.7
// }
export type FuseOptionKeyObject = {
export type FuseOptionKeyObject<T> = {
name: string | string[]
weight: number
weight?: number
getFn?: (obj: T) => ReadonlyArray<string> | string
}

export type FuseOptionKey = FuseOptionKeyObject | string | string[]
export type FuseOptionKey<T> = FuseOptionKeyObject<T> | string | string[]

export interface IFuseOptions<T> {
/** Indicates whether comparisons should be case sensitive. */
Expand All @@ -255,13 +256,13 @@ declare namespace Fuse {
/** When `true`, the calculation for the relevance score (used for sorting) will ignore the `field-length norm`. */
ignoreFieldNorm?: boolean
/** Determines how much the `field-length norm` affects scoring. A value of `0` is equivalent to ignoring the field-length norm. A value of `0.5` will greatly reduce the effect of field-length norm, while a value of `2.0` will greatly increase it. */
fieldNormWeight: number
fieldNormWeight?: number
/** Whether the matches should be included in the result set. When `true`, each record in the result set will include the indices of the matched characters. These can consequently be used for highlighting purposes. */
includeMatches?: boolean
/** Whether the score should be included in the result set. A score of `0`indicates a perfect match, while a score of `1` indicates a complete mismatch. */
includeScore?: boolean
/** List of keys that will be searched. This supports nested paths, weighted search, searching in arrays of `strings` and `objects`. */
keys?: Array<FuseOptionKey>
keys?: Array<FuseOptionKey<T>>
/** Determines approximately where in the text is the pattern expected to be found. */
location?: number
/** Only the matches whose length exceeds this value will be returned. (For instance, if you want to ignore single character matches in the result, set it to `2`). */
Expand Down Expand Up @@ -308,5 +309,5 @@ declare namespace Fuse {
| { $and?: Expression[] }
| { $or?: Expression[] }

export const config: Required<IFuseOptions<any>>;
export const config: Required<IFuseOptions<any>>
}
4 changes: 2 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ declare namespace Fuse {
/** When `true`, the calculation for the relevance score (used for sorting) will ignore the `field-length norm`. */
ignoreFieldNorm?: boolean
/** Determines how much the `field-length norm` affects scoring. A value of `0` is equivalent to ignoring the field-length norm. A value of `0.5` will greatly reduce the effect of field-length norm, while a value of `2.0` will greatly increase it. */
fieldNormWeight: number
fieldNormWeight?: number
/** Whether the matches should be included in the result set. When `true`, each record in the result set will include the indices of the matched characters. These can consequently be used for highlighting purposes. */
includeMatches?: boolean
/** Whether the score should be included in the result set. A score of `0`indicates a perfect match, while a score of `1` indicates a complete mismatch. */
Expand Down Expand Up @@ -319,5 +319,5 @@ declare namespace Fuse {
| { $and?: Expression[] }
| { $or?: Expression[] }

export const config: Required<IFuseOptions<any>>;
export const config: Required<IFuseOptions<any>>
}

0 comments on commit da6e399

Please sign in to comment.