Skip to main content
Home

@std/text@1.0.16
Built and signed on GitHub Actions

Utilities for working with text

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
5 months ago (1.0.16)

default

Utility functions for working with text.

f
closestString

Finds the most similar string from an array of strings.

I
ClosestStringOptions

Options for closestString.

f
compareSimilarity

Takes a string and generates a comparator function to determine which of two strings is more similar to the given one.

I
CompareSimilarityOptions

Options for compareSimilarity.

f
levenshteinDistance

Calculates the Levenshtein distance between two strings.

f
toCamelCase

Converts a string into camelCase.

f
toKebabCase

Converts a string into kebab-case.

f
toPascalCase

Converts a string into PascalCase.

f
toSnakeCase

Converts a string into snake_case.

f
wordSimilaritySort

Sorts a string-array by similarity to a given string.

I
WordSimilaritySortOptions

Options for wordSimilaritySort.

f
closestString

Finds the most similar string from an array of strings.

I
ClosestStringOptions

Options for closestString.

f
compareSimilarity

Takes a string and generates a comparator function to determine which of two strings is more similar to the given one.

I
CompareSimilarityOptions

Options for compareSimilarity.

f
levenshteinDistance

Calculates the Levenshtein distance between two strings.

f
toCamelCase

Converts a string into camelCase.

f
toKebabCase

Converts a string into kebab-case.

f
toPascalCase

Converts a string into PascalCase.

f
toSnakeCase

Converts a string into snake_case.

f
dedent

Removes indentation from multiline strings.

f
longestCommonPrefix

Gets the longest common prefix of an array of strings.

f
reverse

Performs a Unicode-aware string reversal.

T
ReverseOptions

Options for reverse

v
ASCII_DIACRITICS

A regular expression for stripping ASCII diacritics (but not other diacritics) from slugs.

v
DIACRITICS

A regular expression for stripping diacritics from slugs.

v
NON_ASCII

A regular expression for stripping non-ASCII characters from slugs.

v
NON_WORD

A regular expression for stripping non-word characters from slugs.

f
slugify

Converts a string into a slug.

T
SlugifyOptions

Options for slugify.

f
toConstantCase

Converts a string into CONSTANT_CASE (also known as SCREAMING_SNAKE_CASE).

I
BaseTitleCaseOptions

Base options for title-case functions

I
SentenceCaseOptions

Options for toSentenceCase

f
toSentenceCase

Converts a string into Sentence Case.

T
ExcludeWordConfig

A filter function or array of stop words to exclude them from title casing, or multiple filter functions and stop word arrays to combine for filtering.

T
ExcludeWordFilter

A function that filters words in the string. If a word returns true from this function, it will not be title-cased.

I
TitleCaseOptions

Options for toTitleCase

f
toTitleCase

Converts a string into Title Case.

T
TrailingCase

The case for the remaining characters in the string

f
trimBy

Trims all instances of the specified pattern at the start and end of the string.

f
trimEndBy

Trims all instances of the specified pattern at the end of the string.

T
TrimPattern

A pattern that can be used to trim characters from an input string.

f
trimStartBy

Trims all instances of the specified pattern at the start of the string.

f
wordSimilaritySort

Sorts a string-array by similarity to a given string.

I
WordSimilaritySortOptions

Options for wordSimilaritySort.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.