Skip to content

Commit

Permalink
docs(text): pass check_docs.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed May 22, 2024
1 parent 1e16dc9 commit 9286160
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion _tools/check_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ENTRY_POINTS = [
"../internal/mod.ts",
"../jsonc/mod.ts",
"../media_types/mod.ts",
"../text/mod.ts",
"../ulid/mod.ts",
"../webgpu/mod.ts",
] as const;
Expand Down Expand Up @@ -84,7 +85,7 @@ function assertHasReturnTag(document: { jsDoc: JsDoc; location: Location }) {
const tag = document.jsDoc.tags?.find((tag) => tag.kind === "return");
if (tag === undefined) {
diagnostics.push(
new DocumentError("Symbol must have a @return tag", document),
new DocumentError("Symbol must have a @returns tag", document),
);
} else {
assert(
Expand Down
8 changes: 4 additions & 4 deletions text/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { capitalizeWord, splitToWords } from "./_util.ts";
/**
* Converts a string into camelCase.
*
* @example
* @example Usage
* ```ts
* import { toCamelCase } from "@std/text/case";
*
Expand All @@ -25,7 +25,7 @@ export function toCamelCase(input: string): string {
/**
* Converts a string into kebab-case.
*
* @example
* @example Usage
* ```ts
* import { toKebabCase } from "@std/text/case";
*
Expand All @@ -43,7 +43,7 @@ export function toKebabCase(input: string): string {
/**
* Converts a string into PascalCase.
*
* @example
* @example Usage
* ```ts
* import { toPascalCase } from "@std/text/case";
*
Expand All @@ -61,7 +61,7 @@ export function toPascalCase(input: string): string {
/**
* Converts a string into snake_case.
*
* @example
* @example Usage
* ```ts
* import { toSnakeCase } from "@std/text/case";
* toSnakeCase("deno is awesome"); // "deno_is_awesome"
Expand Down
9 changes: 5 additions & 4 deletions text/closest_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getWordDistance = levenshteinDistance;
/**
* get most-similar word
*
* @example
* @example Usage
* ```ts
* import { closestString } from "@std/text/closest-string";
*
Expand All @@ -19,9 +19,10 @@ const getWordDistance = levenshteinDistance;
* const word = closestString("hep", possibleWords);
* ```
*
* @param givenWord - The string to measure distance against
* @param possibleWords - The string-array that will be sorted
* @param options.caseSensitive - Flag indicating whether the distance should include case. Default is false.
* @param givenWord The string to measure distance against
* @param possibleWords The string-array that will be sorted
* @param options An options bag containing a `caseSensitive` flag indicating
* whether the distance should include case. Default is false.
* @returns A sorted copy of possibleWords
* @note
* the ordering of words may change with version-updates
Expand Down
9 changes: 8 additions & 1 deletion text/compare_similarity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ const getWordDistance = levenshteinDistance;
/**
* Sort based on word similarity
*
* @example
* @param givenWord The string to measure distance against.
* @param options An options bag containing a `caseSensitive` flag indicating
* whether the distance should include case. Default is false.
* @returns The difference in distance. This will be a negative number if `a`
* is more similar to `givenWord` than `b`, a positive number if `b` is more
* similar, or `0` if they are equally similar.
*
* @example Usage
* ```ts
* import { compareSimilarity } from "@std/text/compare-similarity";
* const words = ["hi", "hello", "help"];
Expand Down
2 changes: 1 addition & 1 deletion text/levenshtein_distance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* Calculates the Levenshtein distance between two strings.
*
* @example
* @example Usage
* ```ts
* import { levenshteinDistance } from "@std/text/levenshtein-distance";
* levenshteinDistance("aa", "bb"); // 2
Expand Down
5 changes: 3 additions & 2 deletions text/word_similarity_sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { compareSimilarity } from "./compare_similarity.ts";
/**
* Sorts a string-array by similarity to a given string
*
* @example
* @example Usage
* ```ts
* import { wordSimilaritySort } from "@std/text/word-similarity-sort";
*
Expand All @@ -20,7 +20,8 @@ import { compareSimilarity } from "./compare_similarity.ts";
*
* @param givenWord - The string to measure distance against
* @param possibleWords - The string-array that will be sorted
* @param options.caseSensitive - Flag indicating whether the distance should include case. Default is false.
* @param options An options bag containing a `caseSensitive` flag indicating
* whether the distance should include case. Default is false.
* @returns {string[]} A sorted copy of possibleWords
*/
export function wordSimilaritySort(
Expand Down

0 comments on commit 9286160

Please sign in to comment.