Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(text): pass docs check #4837

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
dsherret marked this conversation as resolved.
Show resolved Hide resolved
);
} 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