From 5d406102e370eb76066cb2f5d8177ba9ef0d8e6f Mon Sep 17 00:00:00 2001 From: bent10 Date: Sun, 15 May 2022 19:35:00 +0700 Subject: [PATCH] fix(release): git rm dist --- dist/index.d.ts | 65 ------------------------------------------------- dist/index.js | 34 -------------------------- package.json | 5 +--- 3 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 6790ba1..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Finds similar word(s) in a list of words. - * - * ## Install - * - * ```bash - * npm i find-similar - * ``` - * - * ## Usage - * - * This package is pure ESM, please read the - * [esm-package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). - * - * ```js - * import { findSimilar, didYouMean } from 'find-similar' - * - * console.log(findSimilar('foos', ['bar', 'baz', 'foo'])) - * // => ['foo'] - * - * // Suggests similar words - * console.log(didYouMean('foos', ['bar', 'baz', 'foo'])) - * // => 'Did you mean "foo"?' - * ``` - * - * @module - */ -export declare type Options = { - /** - * Maximum levenshtein distance threshold. - * - * @default 3 - */ - maxScore?: number; - /** - * The similarity threshold, a number between 0 and 1. - * - * @default 0.5 - */ - criteria?: number; - /** - * A string to prepend to the suggested word. - * - * @default '' - */ - prefix?: string; -}; -/** - * Finds similar word(s) in a list of words. - * - * @param word - The word to find similar words for. - * @param candidates - An array of words to compare against. - * @param options - Options for the function. - * @returns An array of similar words. - */ -export declare function findSimilar(word: string, candidates: readonly string[] | string[], options?: Options): string[]; -/** - * Suggests similar words in a list of words. - * - * @param word - The word to find similar words for. - * @param candidates - An array of words to compare against. - * @param options - Options for the function. - * @returns A string of suggested words. - */ -export declare function didYouMean(word: string, candidates: readonly string[] | string[], options?: Options): string; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 829fa58..0000000 --- a/dist/index.js +++ /dev/null @@ -1,34 +0,0 @@ -// src/index.ts -import leven from "leven"; -function findSimilar(word, candidates, options = {}) { - let { maxScore = 3 } = options; - const { criteria = 0.5, prefix = "" } = options; - const matches = []; - for (const candidate of candidates) { - const length = Math.max(word.length, candidate.length); - const score = leven(word, candidate); - const similarity = (length - score) / length; - if (similarity >= criteria && score <= maxScore) { - if (score < maxScore) { - maxScore = score; - matches.length = 0; - } - matches.push(prefix + candidate); - } - } - return matches; -} -function didYouMean(word, candidates, options = {}) { - const matches = findSimilar(word, candidates, options); - let message = "Did you mean "; - if (matches.length > 0) { - matches.length > 1 && (message += "one of "); - message += `"${matches.join(", ")}"?`; - return message; - } - return ""; -} -export { - didYouMean, - findSimilar -}; diff --git a/package.json b/package.json index 38526c7..87a98e3 100644 --- a/package.json +++ b/package.json @@ -104,10 +104,7 @@ "@semantic-release/git", { "assets": [ - "dist/**", - "changelog.md", - "readme.md", - "license" + "changelog.md" ], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" }