@arki/string

next

for @arki/[email protected] · Tier 2: standalone libraries · MIT

A string toolkit with canonical encoding failures from @arki/failure.

Version 0.3.0 next

Install

The latest version on npm is 0.2.0 archive, not supported

bun add @arki/string
Other package managers
npm install @arki/string
pnpm add @arki/string
yarn add @arki/string

Release health for @arki/[email protected]

Doc examples

14 compiled4 run0 skipped

Open gaps

6 release checks fail

  • checkfile-llms-txt
  • checkfile-agents-md
  • checkfile-agent-guide
  • checkreadme-h2-order
  • checkpkg-engines
  • checkfiles-ship-dist-docs

Used by demos

No demo uses this package yet.

Runtimes

No engines field, so no runtime requirement is declared.

Benchmarks

No benchmarks are published for this version.

README

A string toolkit with canonical encoding failures from @arki/failure. Positions count what a reader sees (graphemes), not UTF-16 units. Use plain functions by concern, or one immutable fluent wrapper.

Install

bun add @arki/string
# or
npm install @arki/string

Quick start

Turn a blog post into what an index page needs: a URL slug, a one-line summary that stops at a word, and a reading time.

import { squish, truncate } from '@arki/string/format';
import { readingTime } from '@arki/string/readability';
import { slugify } from '@arki/string/slug';
 
const title = 'Café Guide & Notes';
const body = 'We moved the ledger to a new   database last week.\n\nThe move took two hours.';
 
const slug = slugify(title); // 'cafe-guide-and-notes'
const summary = truncate(squish(body), 40, { boundary: 'word-before' }); // never cuts a word or an emoji
const minutes = Math.max(1, Math.round(readingTime(body).minutes));
 
if (slug !== 'cafe-guide-and-notes') throw new Error(slug);
if (summary !== 'We moved the ledger to a new database…') throw new Error(summary);
if (minutes !== 1) throw new Error(String(minutes));

The tested version is examples/describe-post.ts. Its tests pin the slug, the summary and the minimum of one minute.

/** What a blog index needs from a post: a URL slug, a one-line summary and a reading time. */
export function describePost(title: string, body: string): { slug: string; summary: string; minutes: number } {
  return {
    slug: slugify(title),
    summary: truncate(squish(body), 60, { boundary: 'word-before' }),
    minutes: Math.max(1, Math.round(readingTime(body).minutes)),
  };
}

When not to use this

  • You need to check that a string is a URL or base64. Use a schema, such as Zod's z.url() or z.base64(), with is or assert from @arki/schema. This package encodes and decodes base64 and does not validate URLs.
  • You need to parse, strip or sanitize HTML. Use a dedicated HTML parser or sanitizer. escapeHtml here only escapes text. It does not sanitize.
  • You need dates, durations or relative time. Use @arki/date.
  • You need hyphenation, dictionaries or embeddings. Use the @arki/text-* packages.
  • You need English pluralization or number and byte formatting. They are out of scope on purpose.
  • You need cryptographic hashing. hashCode is a fast 32-bit hash and is not secure.

Runtime support

Node 24+, Bun, Deno, every evergreen browser, and React Native (Hermes). The library uses only ECMAScript 2022 plus Unicode property escapes: no Buffer, atob, TextEncoder, node: imports, or ES2023 array-copy methods. The one feature check is Intl.Segmenter, with an in-house fallback that follows Unicode 18 (ICU engines through Unicode 17 still split a leading Indic virama from the consonant after it). A lint rule and a test (src/runtime.test.ts) fail the build if any of that changes.

Three more checks keep the claim honest:

  • bun run smoke builds nothing itself; after bun run build it imports dist/ under Node, Node with Intl.Segmenter deleted (the Hermes path), Bun, and Deno, and runs one check per subpath on each.
  • src/internal/graphemes.fuzz.test.ts compares the fallback scanner with the engine's Intl.Segmenter on 3000 seeded random strings built from the hard cases (ZWJ sequences, flags, tags, Hangul jamo, Indic conjuncts, CR LF).
  • src/performance.test.ts guards the paths that used to be quadratic by comparing a large input against a small one, so a regression fails the suite on any machine.

With Intl.Segmenter, the native path segments a growing prefix instead of the whole string, so at(text, 5) costs the same on 10k and 100k characters.

RuntimeResultVersion testedDate (UTC)
nodepassv26.11.12026-10-17
bunpass1.4.22026-10-17
denopass2.9.72026-10-17
browserpassChromium 156.0.8078.42026-10-17
hermesnot run-2026-10-17

Public imports

The root entry @arki/string re-exports everything. Each concern also has its own subpath, so a bundler keeps only what you import.

SubpathFunctions
/unicodegraphemes, length, at, slice, take, reverse, splice, chunk, fold, graphemeBoundaries
/casecaseWords, camelCase, pascalCase, snakeCase, kebabCase, constantCase, dotCase, pathCase, titleCase, sentenceCase, capitalize, uncapitalize
/formatcollapseWhitespace, squish, initials, truncate, excerpt, wrapText, dedent
/segmentlines, words, wordCount, sentences, sentenceCount, paragraphs, paragraphCount
/searchbefore, after, between, containsAny, indexOf
/editreplaceFirst, replaceLast, replaceAll, replaceStart, replaceEnd, ensureStart, ensureEnd, trimPrefix, trimSuffix, swap, deduplicate, wrap, unwrap, mask, padStart, padEnd, padBoth
/escapeescapeHtml, escapeRegExp
/interpolateinterpolate
/slugslugify, transliterate, rulesets (per-language rule sets)
/slug-cjkchinese, korean opt-in rule sets
/base64toBase64, fromBase64, tryFromBase64, bytesToBase64, base64ToBytes, utf8Encode, utf8Decode, byteLength
/readabilitysyllableCount, fleschReadingEase, fleschKincaidGrade, gunningFog, smogIndex, colemanLiauIndex, automatedReadabilityIndex, lix, fleschReadingEaseLevel, readability, fernandezHuerta, szigrisztPazos, fleschAmstad, wienerSachtextformel, readingTime, speakingTime
/keywordskeywords, STOP_WORDS
/vocabularyuniqueWordCount, wordFrequencies, lexicalDiversity, yulesK, simpsonsDiversityIndex, wordLengthStats
/metricstextMetrics (everything above in one object), analyze
/distancelevenshtein, diceCoefficient, jaroWinkler
/hashhashCode
/fluentstr, StringValue

Failure behaviour

UTF-8/base64 APIs return canonical @arki/failure values with stable codes, status 400, and remediation. Successes remain plain numbers, bytes, or text. Narrow with isFailure before using them; fluent codecs return StringValue or the same failures. No submitted input is included in failures.

Breaking: tryFromBase64 now aliases fromBase64 and never returns null. Replace null checks and encoding StringError catches with failure narrowing. Other static misuse still throws StringError from @arki/string/errors; the legacy E002/E003 diagnostic exports remain available.

CodeRaised byMeaning
ARKI_STRING_E001padStart, mask, truncate, wrapText, indexOf, keywords, chunk, slugify, readingTime, search helpers, and othersAn argument is out of range: empty needle, negative or non-integer length, bad glyph.
string.invalid_utf8toBase64, byteLength, utf8Encode, utf8Decode, fromBase64Text or bytes are not valid UTF-8.
string.invalid_base64base64ToBytes, fromBase64Input is not strict base64.
ARKI_STRING_E004interpolateA placeholder is malformed.
ARKI_STRING_E005interpolateA placeholder has no value and missing is 'throw'.

Handle bad user input without a try block:

import { isFailure } from '@arki/failure';
import { fromBase64, InvalidBase64 } from '@arki/string/base64';
 
const decoded = fromBase64('not base64!');
if (!isFailure(decoded) || !InvalidBase64.is(decoded)) throw new Error('expected base64 failure');

Limits

  • Segmentation follows Unicode 18 on the fallback path. ICU engines through Unicode 17 still split a leading Indic virama from the consonant after it. A string with that sequence can measure differently on Hermes than on V8.
  • slugify('ä ö') gives ae-oe (German rules). slugify('ä ö', { locale: 'sv' }) gives a-o. Pass locale when the language is not German.
  • Chinese and Korean transliteration is opt-in through @arki/string/slug-cjk, because the tables are large. Without it, those characters are dropped from a slug.
  • interpolate takes flat identifier keys. {{ user.name }} is a StringError (ARKI_STRING_E004).
  • Base64 decoding is strict. A string with a newline, a mixed alphabet or bad padding returns InvalidBase64. Handle the failure before using decoded text.
  • escapeHtml is not a sanitizer. It makes text safe inside HTML text and attribute values and does nothing for URLs, scripts or styles.
  • syllableCount and the readability scores use a heuristic for English, Spanish and German. They suit grades and reading time. They do not suit hyphenation.

Two ways to use it

Named functions, tree-shakeable by concern:

import { toBase64 } from '@arki/string/base64';
import { camelCase } from '@arki/string/case';
import { squish, truncate } from '@arki/string/format';
 
camelCase('XMLHttpRequest v2Beta'); // 'xmlHttpRequestV2Beta'
truncate('The quick brown fox', 10, { boundary: 'word-before' }); // 'The quick…'
toBase64('crème brûlée 👋', { alphabet: 'url' });

Or the immutable fluent wrapper:

import { str } from '@arki/string/fluent';
 
str('  XML_http_request  ').squish().titleCase().truncate(24).value(); // 'Xml Http Request'
str('/articles/hello.md').after('/articles/').trimSuffix('.md').value(); // 'hello'
str(' [email protected] ').trim().lower().value(); // '[email protected]'

Every method returns a new StringValue; nothing mutates. Literal searches (includes, startsWith, endsWith, replaceAll, …) are grapheme-aligned like the plain functions, and replacement strings are literal ($& stays $&). Extract with .value() (or toString(), template literals, JSON.stringify). Note that Boolean(str('')) is true like any object, so use .isEmpty().

The root entry @arki/string re-exports everything.

Unicode model

JavaScript strings are UTF-16: '👨‍👩‍👧‍👦'.length is 11 and .slice() can split an emoji in half. Positional functions in this package count grapheme clusters (user-perceived characters) instead:

import { at, chunk, length, reverse, slice, take } from '@arki/string/unicode';
 
length('👨‍👩‍👧‍👦'); // 1
at('A👩‍💻B', 1); // '👩‍💻'
take('A👩‍💻B', -2); // '👩‍💻B'
reverse('🇷🇴é'); // 'é🇷🇴'

Segmentation uses Intl.Segmenter when the engine has it, and an in-house UAX #29 scanner otherwise (Hermes). The scanner is driven by Unicode property escapes, so the engine's own tables supply the data, and it is tested against the official GraphemeBreakTest corpus. For UTF-16 units use native .length; for bytes use utf8Encode.

Literal searches (before, after, replaceFirst, ensureStart, …) only match on grapheme boundaries, so searching e never matches part of é in decomposed form.

Reference by concern

Case conversion

All case functions share one tokenizer, caseWords, so they split identifiers identically. Tokens are letters, numbers, and marks; digits stay attached to the preceding token; an uppercase run ends before its last capital when a lowercase letter follows.

InputTokenssnakeCase
XMLHttpRequestXML, Http, Requestxml_http_request
v2Betav2, Betav2_beta
iPhone11Proi, Phone11, Proi_phone11_pro
crème brûléecrème, brûléecrème_brûlée
don't-stopdont, stopdont_stop

Casing is locale-independent unless you pass { locale: 'tr' }; the machine locale is never used. titleCase and sentenceCase build labels from tokens and discard punctuation; capitalize only touches the first grapheme.

Format

  • truncate(text, max, { ellipsis, boundary }) enforces a total grapheme budget that includes the ellipsis (… by default) and never leaves whitespace before it. boundary: 'word-before' backs up to the previous word; 'sentence' backs up to the last sentence end that fits, or to a word when none does.
  • excerpt(text, needle, { radius, boundary }) returns the context around the first match. boundary: 'word' | 'sentence' pulls each edge inward to the nearest boundary without crossing the match, so radius stays a hard maximum; a sentence edge out of reach degrades to a word edge on that side.
  • initials('Ada King Lovelace') is 'AL'; { pick: 'first' } gives 'AK'; { singleWord: 2 } turns a lone 'Alex' into 'AL'.
  • dedent strips the shared indentation and one surrounding blank line, as a function or a template tag, for SQL and prompt templates.
  • squish is collapseWhitespace plus a trim.

Unicode folding and similarity

import { jaroWinkler, levenshtein } from '@arki/string/distance';
import { fold } from '@arki/string/unicode';
 
fold('Émile Zola'); // 'emile zola' — lowercase, marks stripped, ß/ø/ł spelled out
levenshtein('kitten', 'sitting'); // 3, counted in graphemes
jaroWinkler(fold('Émile Zola'), fold('emile zola')); // 1
  • fold is the search-key form: compare fold(a) === fold(b) or feed both sides to a distance. It does no script conversion; that is transliterate in /slug.
  • levenshtein, diceCoefficient (grapheme bigrams) and jaroWinkler (name matching, prefix-boosted) are all measured in graphemes.

Segment

One definition of a word, sentence, line, and paragraph, shared by every counting and scoring function in the package. Regular expressions only, so results are identical on every runtime.

  • words counts prose words: don't, re-enter, and 3.14 are one word each. Scripts without word spacing yield one word per run.
  • sentences splits after ., !, ?, or … followed by whitespace; a trailing fragment with a letter or digit counts. Mr. is not special-cased.
  • paragraphs are non-blank lines, so single- and double-newline text agree.
  • lines splits on CRLF, LF, CR, NEL, LS, and PS and keeps trailing empties.

Readability, keywords, vocabulary, metrics

import { keywords } from '@arki/string/keywords';
import { textMetrics } from '@arki/string/metrics';
import { readability, readingTime, syllableCount } from '@arki/string/readability';
import { lexicalDiversity, wordFrequencies } from '@arki/string/vocabulary';
 
declare const article: string;
declare const articulo: string;
 
readability(article).fleschKincaidGrade; // 8.4
readability(articulo, { language: 'es' }).fernandezHuerta; // Spanish score set
readingTime(article); // { words: 1200, seconds: 302.5, minutes: 5.04 }
keywords(article, { length: 2, limit: 5 }); // [{ keyword: 'machine learning', occurrences: 7, percentage: 1.9 }, …]
textMetrics(article); // every count, score, and statistic in one object
  • Syllables use an English heuristic (vowel groups with silent-e, -ed, -es, -le and hiatus rules). It is meant for readability grades, not for hyphenation; words without Latin letters count 0. syllableCount(text, { language: 'es' | 'de' }) switches to Spanish (diphthong/hiatus rules, silent u in que/gui) or German (one syllable per vowel group) counting.

  • readability(text) is the English score set (Flesch Reading Ease clamped to 0–100, 100 for text without words; grade indexes return 0). readability(text, { language: 'es' }) returns fernandezHuerta and szigrisztPazos (0–100, higher is easier); 'de' returns fleschAmstad (0–100) and wienerSachtextformel (a school grade). Each language uses its own syllable counter, and every formula is also exported on its own.

  • Every readability, vocabulary and metrics function accepts a string or a TextAnalysis from analyze(text) (in /metrics). Analyze once, pass it to several functions, or write your own formula against its words, sentences, syllables and letter counts:

    import { analyze } from '@arki/string/metrics';
    import { fleschKincaidGrade, lix } from '@arki/string/readability';
     
    declare const text: string;
     
    const a = analyze(text);
    const grade = fleschKincaidGrade(a);
    const lixScore = lix(a);
    const longWordShare = a.words.filter(w => w.length > 6).length / a.words.length;
  • keywords builds 1-, 2-, or 3-word phrases that never cross clause punctuation and never contain a stop word or a word under minWordLength graphemes. The stop-word list follows language ('en' default, 'es', 'de', 'fr', 'ro'; all lists are in STOP_WORDS); pass your own stopWords or stopWords: null to disable.

  • Vocabulary functions compare words lowercased; pass { locale } for locale-sensitive lowercasing.

  • hashCode (in /hash) is the non-negative Java String.hashCode over UTF-16 units: stable, fast, and not cryptographic.

Base64 and UTF-8

No Buffer, atob, or btoa. Text functions are UTF-8; byte functions take and return Uint8Array. Decoding is strict: whitespace, mixed alphabets, bad padding, impossible lengths, and nonzero unused bits return InvalidBase64; invalid UTF-8 returns InvalidUtf8. tryFromBase64 is an alias of fromBase64.

import { base64ToBytes, fromBase64, toBase64 } from '@arki/string/base64';
 
toBase64('f'); // 'Zg=='
toBase64('f', { alphabet: 'url' }); // 'Zg'  (url defaults to no padding)
base64ToBytes('/w=='); // Uint8Array [255]
fromBase64('/w=='); // InvalidUtf8 failure: not UTF-8

Slugs

import { slugify, transliterate } from '@arki/string/slug';
 
slugify('Привет мир'); // 'privet-mir'
slugify('Nguyễn Đăng Khoa'); // 'nguyen-dang-khoa'
slugify('fooBar & baz'); // 'foo-bar-and-baz'
slugify('Hello World', { separator: '_', lowercase: false }); // 'Hello_World'
slugify('ä ö', { locale: 'sv' }); // 'a-o'  (German default would give 'ae-oe')
transliterate('crème brûlée'); // 'creme brulee'

Transliteration covers Latin, Cyrillic, Greek, Arabic, Armenian, Georgian, Hindi, Burmese, Vietnamese, Yiddish, and more, with curated per-language rule sets ported from cocur/slugify and the general table from @sindresorhus/transliterate. Priority is: your replacements, then locale overrides, then the curated sets, then the general table, then remaining diacritics are stripped. Chinese (pinyin) and Korean rule sets are large, so they are opt-in:

import { slugify } from '@arki/string/slug';
import { chinese } from '@arki/string/slug-cjk';
 
slugify('我是谁', { replacements: chinese }); // 'wo-shi-shui'

Interpolation

import { interpolate } from '@arki/string/interpolate';
 
interpolate('Hi {{ name }}', { name: 'Ada' }); // 'Hi Ada'
interpolate('{{ missing }}', {}); // throws StringError ARKI_STRING_E005
interpolate('{{ missing }}', {}, { missing: 'keep' }); // '{{ missing }}'

Flat identifier keys only. null renders as '', undefined is missing. \{{ emits a literal {{. Output is plain text; call escapeHtml separately.

Documentation

@arki/string works on its own. With the @arki/dot application framework, see packages/dot/docs/.

Support

Report a bug or ask a question at github.com/arki-labs/arki/issues. Include the input string, the function and the result you expected.

Benchmarks

Speed of @arki/string against lodash-es, change-case, slugify and escape-html, the libraries most projects use for case conversion, truncation, slugs and escaping.

Node v22.13.1 on Apple M2 Max, 2026-10-13. Median time per operation, lower is better.

camelCase

LibraryTime / opvs fastest
@arki/string camelCase45.23 µs21.84×
lodash-es camelCase2.07 µsfastest
change-case camelCase2.90 µs1.40×

kebabCase

LibraryTime / opvs fastest
@arki/string kebabCase3.88 µs2.11×
lodash-es kebabCase1.84 µsfastest
change-case kebabCase2.94 µs1.60×

Truncate 228 characters to 80

Every library ends the result with … inside the 80-character limit. lodash cuts at a code unit; @arki/string cuts at a grapheme.

LibraryTime / opvs fastest
@arki/string truncate103.49 µs1671.23×
lodash-es truncate61.9 nsfastest

Slugify an accented title

LibraryTime / opvs fastest
@arki/string slugify9.29 µsfastest
slugify (lower, strict)13.78 µs1.48×

Escape HTML (a 63-character tag with quotes and ampersands)

LibraryTime / opvs fastest
@arki/string escapeHtml2.05 µs3.37×
escape-html610.4 nsfastest
lodash-es escape992.4 ns1.63×

Escape a string for use in a RegExp

@arki/string also escapes a leading letter or digit as \xNN, so the result is safe to paste after a backslash or inside a character class; lodash does not.

LibraryTime / opvs fastest
@arki/string escapeRegExp2.65 µs2.53×
lodash-es escapeRegExp1.05 µsfastest

Read the rows with the contracts in mind:

  • Case inputs are plain ASCII so every library does the same work. With accents, lodash strips them (café becomes cafe) while @arki/string and change-case keep them.
  • @arki/string counts user-perceived characters (graphemes), so it never cuts an emoji or an accented letter in half. lodash truncate counts UTF-16 code units. Counting graphemes is more work, which shows in the truncate row.
  • Slugs differ by design: @arki/string transliterates ü to ue and & to and (German rules), slugify gives u and drops &; both are configurable. Outputs of the same input are not identical, so compare speed, not output.
  • escape-html, lodash escape and @arki/string produce the same output for HTML text and attribute values.

Reproduce with bun run bench in the package directory; regenerate this section with bun run bench --write-readme.

License

MIT. See LICENSE.

Docs 2 pages in 0.3.0

Public imports 20 paths · 290 exports

Import pathExportsFirst names
@arki/string144 exportsafter, analyze, at, automatedReadabilityIndex, …
All 144 names
  • after function
  • analyze function
  • at function
  • automatedReadabilityIndex function
  • Base64Options type
  • base64ToBytes function
  • before function
  • between function
  • byteLength function
  • bytesToBase64 function
  • camelCase function
  • capitalize function
  • CaseOptions type
  • caseWords function
  • chunk function
  • colemanLiauIndex function
  • collapseWhitespace function
  • constantCase function
  • containsAny function
  • dedent function
  • deduplicate function
  • diceCoefficient function
  • dotCase function
  • ensureEnd function
  • ensureStart function
  • escapeHtml function
  • escapeRegExp function
  • excerpt function
  • ExcerptOptions type
  • fernandezHuerta function
  • fleschAmstad function
  • fleschKincaidGrade function
  • fleschReadingEase function
  • fleschReadingEaseLevel function
  • fold function
  • FoldOptions type
  • fromBase64 function
  • GermanReadabilityScores type
  • graphemeBoundaries function
  • graphemes function
  • gunningFog function
  • hashCode function
  • indexOf function
  • initials function
  • InitialsOptions type
  • interpolate function
  • InterpolateOptions type
  • InvalidBase64 variable
  • InvalidUtf8 variable
  • jaroWinkler function
  • JaroWinklerOptions type
  • kebabCase function
  • Keyword type
  • KeywordLanguage type
  • KeywordOptions type
  • keywords function
  • length function
  • levenshtein function
  • lexicalDiversity function
  • lines function
  • lix function
  • mask function
  • MaskOptions type
  • NormalizationForm type
  • Occurrence type
  • padBoth function
  • padEnd function
  • padStart function
  • paragraphCount function
  • paragraphs function
  • pascalCase function
  • pathCase function
  • readability function
  • ReadabilityLevel type
  • ReadabilityOptions type
  • ReadabilityScores type
  • readingTime function
  • ReadingTime type
  • replaceAll function
  • replaceEnd function
  • replaceFirst function
  • replaceLast function
  • Replacements type
  • replaceStart function
  • reverse function
  • rulesets variable
  • sentenceCase function
  • sentenceCount function
  • sentences function
  • simpsonsDiversityIndex function
  • slice function
  • slugify function
  • SlugifyOptions type
  • smogIndex function
  • snakeCase function
  • SpanishReadabilityScores type
  • speakingTime function
  • splice function
  • squish function
  • STOP_WORDS variable
  • str function
  • STRING_ERROR_CODES variable
  • StringError class
  • StringErrorCode type
  • StringValue class
  • swap function
  • syllableCount function
  • SyllableLanguage type
  • SyllableOptions type
  • szigrisztPazos function
  • take function
  • TemplateValues type
  • TextAnalysis class
  • TextInput type
  • textMetrics function
  • TextMetrics type
  • TimeOptions type
  • titleCase function
  • toBase64 function
  • Transform type
  • transliterate function
  • TransliterateOptions type
  • trimPrefix function
  • trimSuffix function
  • truncate function
  • TruncateOptions type
  • tryFromBase64 variable
  • uncapitalize function
  • uniqueWordCount function
  • unwrap function
  • utf8Decode function
  • utf8Encode function
  • VocabularyOptions type
  • wienerSachtextformel function
  • wordCount function
  • wordFrequencies function
  • WordFrequency type
  • wordLengthStats function
  • WordLengthStats type
  • words function
  • wrap function
  • wrapText function
  • WrapTextOptions type
  • yulesK function
@arki/string/base6411 exportsBase64Options, base64ToBytes, byteLength, bytesToBase64, …
All 11 names
  • Base64Options type
  • base64ToBytes function
  • byteLength function
  • bytesToBase64 function
  • fromBase64 function
  • InvalidBase64 variable
  • InvalidUtf8 variable
  • toBase64 function
  • tryFromBase64 variable
  • utf8Decode function
  • utf8Encode function
@arki/string/case13 exportscamelCase, capitalize, CaseOptions, caseWords, …
All 13 names
  • camelCase function
  • capitalize function
  • CaseOptions type
  • caseWords function
  • constantCase function
  • dotCase function
  • kebabCase function
  • pascalCase function
  • pathCase function
  • sentenceCase function
  • snakeCase function
  • titleCase function
  • uncapitalize function
@arki/string/distance4 exportsdiceCoefficient, jaroWinkler, JaroWinklerOptions, levenshtein
All 4 names
  • diceCoefficient function
  • jaroWinkler function
  • JaroWinklerOptions type
  • levenshtein function
@arki/string/edit18 exportsdeduplicate, ensureEnd, ensureStart, mask, …
All 18 names
  • deduplicate function
  • ensureEnd function
  • ensureStart function
  • mask function
  • MaskOptions type
  • padBoth function
  • padEnd function
  • padStart function
  • replaceAll function
  • replaceEnd function
  • replaceFirst function
  • replaceLast function
  • replaceStart function
  • swap function
  • trimPrefix function
  • trimSuffix function
  • unwrap function
  • wrap function
@arki/string/errors3 exportsSTRING_ERROR_CODES, StringError, StringErrorCode
All 3 names
  • STRING_ERROR_CODES variable
  • StringError class
  • StringErrorCode type
@arki/string/escape2 exportsescapeHtml, escapeRegExp
All 2 names
  • escapeHtml function
  • escapeRegExp function
@arki/string/fluent4 exportsNormalizationForm, str, StringValue, Transform
All 4 names
  • NormalizationForm type
  • str function
  • StringValue class
  • Transform type
@arki/string/format11 exportscollapseWhitespace, dedent, excerpt, ExcerptOptions, …
All 11 names
  • collapseWhitespace function
  • dedent function
  • excerpt function
  • ExcerptOptions type
  • initials function
  • InitialsOptions type
  • squish function
  • truncate function
  • TruncateOptions type
  • wrapText function
  • WrapTextOptions type
@arki/string/hash1 exporthashCode
All 1 names
  • hashCode function
@arki/string/interpolate3 exportsinterpolate, InterpolateOptions, TemplateValues
All 3 names
  • interpolate function
  • InterpolateOptions type
  • TemplateValues type
@arki/string/keywords5 exportsKeyword, KeywordLanguage, KeywordOptions, keywords, …
All 5 names
  • Keyword type
  • KeywordLanguage type
  • KeywordOptions type
  • keywords function
  • STOP_WORDS variable
@arki/string/metrics5 exportsanalyze, TextAnalysis, TextInput, textMetrics, …
All 5 names
  • analyze function
  • TextAnalysis class
  • TextInput type
  • textMetrics function
  • TextMetrics type
@arki/string/readability25 exportsautomatedReadabilityIndex, colemanLiauIndex, fernandezHuerta, fleschAmstad, …
All 25 names
  • automatedReadabilityIndex function
  • colemanLiauIndex function
  • fernandezHuerta function
  • fleschAmstad function
  • fleschKincaidGrade function
  • fleschReadingEase function
  • fleschReadingEaseLevel function
  • GermanReadabilityScores type
  • gunningFog function
  • lix function
  • readability function
  • ReadabilityLevel type
  • ReadabilityOptions type
  • ReadabilityScores type
  • readingTime function
  • ReadingTime type
  • smogIndex function
  • SpanishReadabilityScores type
  • speakingTime function
  • syllableCount function
  • SyllableLanguage type
  • SyllableOptions type
  • szigrisztPazos function
  • TimeOptions type
  • wienerSachtextformel function
@arki/string/search6 exportsafter, before, between, containsAny, …
All 6 names
  • after function
  • before function
  • between function
  • containsAny function
  • indexOf function
  • Occurrence type
@arki/string/segment7 exportslines, paragraphCount, paragraphs, sentenceCount, …
All 7 names
  • lines function
  • paragraphCount function
  • paragraphs function
  • sentenceCount function
  • sentences function
  • wordCount function
  • words function
@arki/string/slug6 exportsReplacements, rulesets, slugify, SlugifyOptions, …
All 6 names
  • Replacements type
  • rulesets variable
  • slugify function
  • SlugifyOptions type
  • transliterate function
  • TransliterateOptions type
@arki/string/slug-cjk2 exportschinese, korean
All 2 names
  • chinese variable
  • korean variable
@arki/string/unicode11 exportsat, chunk, fold, FoldOptions, …
All 11 names
  • at function
  • chunk function
  • fold function
  • FoldOptions type
  • graphemeBoundaries function
  • graphemes function
  • length function
  • reverse function
  • slice function
  • splice function
  • take function
@arki/string/vocabulary9 exportslexicalDiversity, simpsonsDiversityIndex, uniqueWordCount, VocabularyOptions, …
All 9 names
  • lexicalDiversity function
  • simpsonsDiversityIndex function
  • uniqueWordCount function
  • VocabularyOptions type
  • wordFrequencies function
  • WordFrequency type
  • wordLengthStats function
  • WordLengthStats type
  • yulesK function

Every export with its signature, as JSON