diff --git a/dist/fuse.d.ts b/dist/fuse.d.ts index c5e845bc6..316a533fc 100644 --- a/dist/fuse.d.ts +++ b/dist/fuse.d.ts @@ -5,40 +5,40 @@ export = Fuse; export as namespace Fuse; interface SearchOpts { - limit?: number + limit?: number; } declare class Fuse> { - constructor(list: ReadonlyArray, options?: O) + constructor(list: ReadonlyArray, options?: O); search< /** Type of item of return */ R = O extends { id: string } ? string : T, /** include score (boolean) */ - S = O['includeScore'], + S = O["includeScore"], /** include matches (boolean) */ - M = O['includeMatches'], - >(pattern: string, opts?: SearchOpts): - S extends true ? ( - M extends true ? - (Fuse.FuseResultWithMatches & Fuse.FuseResultWithScore)[] : - Fuse.FuseResultWithScore[] - ) : ( - M extends true ? - Fuse.FuseResultWithMatches[] : - R[] - ) + M = O["includeMatches"] + >( + pattern: string, + opts?: SearchOpts + ): S extends true + ? M extends true + ? (Fuse.FuseResultWithMatches & Fuse.FuseResultWithScore)[] + : Fuse.FuseResultWithScore[] + : M extends true + ? Fuse.FuseResultWithMatches[] + : R[]; setCollection(list: ReadonlyArray): ReadonlyArray; - list: ReadonlyArray + list: ReadonlyArray; } declare namespace Fuse { export interface FuseResultWithScore { - item: T, + item: T; score: number; } export interface FuseResultWithMatches { - item: T, + item: T; matches: any; } export interface FuseOptions { diff --git a/release.sh b/release.sh index 380083389..e9446c37c 100755 --- a/release.sh +++ b/release.sh @@ -12,6 +12,16 @@ done < package.json; echo $version; +on_master_branch () { + [[ $(git symbolic-ref --short -q HEAD) == "master" ]] && return 0 + return 1 +} + +if ! on_master_branch; then + echo -e "\033[0;31mRefusing to release from non master branch.\033[0m" + exit 1 +fi + read -e -p "Are you sure you want to release? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then diff --git a/src/bitap/bitap_matched_indices.js b/src/bitap/bitap_matched_indices.js index 73c017d99..be3f2254e 100644 --- a/src/bitap/bitap_matched_indices.js +++ b/src/bitap/bitap_matched_indices.js @@ -19,7 +19,7 @@ module.exports = (matchmask = [], minMatchCharLength = 1) => { // (i-1 - start) + 1 => i - start if (matchmask[i - 1] && (i - start) >= minMatchCharLength) { - matchedIndices.push([start, i - 1]) + matchedIndices.push([start, i - 1]); } return matchedIndices diff --git a/src/bitap/index.js b/src/bitap/index.js index d40d88da6..506f8b3f1 100644 --- a/src/bitap/index.js +++ b/src/bitap/index.js @@ -3,7 +3,7 @@ const bitapSearch = require('./bitap_search') const patternAlphabet = require('./bitap_pattern_alphabet') class Bitap { - constructor (pattern, { + constructor(pattern, { // Approximately where in the text is the pattern expected to be found? location = 0, // Determines how close the match must be to the fuzzy location (specified above). @@ -48,7 +48,7 @@ class Bitap { } } - search (text) { + search(text) { const { isCaseSensitive, includeMatches } = this.options if (!isCaseSensitive) { diff --git a/src/typings.d.ts b/src/typings.d.ts index 7cd9f3283..b87abf7a1 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -4,40 +4,40 @@ export = Fuse; export as namespace Fuse; interface SearchOpts { - limit?: number + limit?: number; } declare class Fuse> { - constructor(list: ReadonlyArray, options?: O) + constructor(list: ReadonlyArray, options?: O); search< /** Type of item of return */ R = O extends { id: string } ? string : T, /** include score (boolean) */ - S = O['includeScore'], + S = O["includeScore"], /** include matches (boolean) */ - M = O['includeMatches'], - >(pattern: string, opts?: SearchOpts): - S extends true ? ( - M extends true ? - (Fuse.FuseResultWithMatches & Fuse.FuseResultWithScore)[] : - Fuse.FuseResultWithScore[] - ) : ( - M extends true ? - Fuse.FuseResultWithMatches[] : - R[] - ) + M = O["includeMatches"] + >( + pattern: string, + opts?: SearchOpts + ): S extends true + ? M extends true + ? (Fuse.FuseResultWithMatches & Fuse.FuseResultWithScore)[] + : Fuse.FuseResultWithScore[] + : M extends true + ? Fuse.FuseResultWithMatches[] + : R[]; setCollection(list: ReadonlyArray): ReadonlyArray; - list: ReadonlyArray + list: ReadonlyArray; } declare namespace Fuse { export interface FuseResultWithScore { - item: T, + item: T; score: number; } export interface FuseResultWithMatches { - item: T, + item: T; matches: any; } export interface FuseOptions {