Skip to main content
Home

A great set of 55+ functions for working with strings.

This package works with Node.js, Deno, Bun, BrowsersIt is unknown whether this package works with Cloudflare Workers
It is unknown whether 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
2 weeks ago (3.3.1)

A great set of utilities for interacting with strings. Serving 57 functions.

Examples

Example 1

import { validate, normalize, type UnknownString } from "@zakahacecosas/string-utils";

const searchQuery: UnknownString = getSearchQuery() // example
if (!validate(searchQuery)) return []; // ensure it's not an empty or undefined string

const cleanSearchQuery = normalize(searchQuery); // normalize accents, trailing space, etc...
return searchResults(cleanSearchQuery); // example

Example 2

import { toTitleCase, capitalizeWords } from "@zakahacecosas/string-utils";

function createBook(title: string, author: string) {
 const bookTitle = toTitleCase(title);
 const bookAuthor = capitalizeWords(author);

 return {
  bookTitle,
  bookAuthor,
  publishedAt: new Date(),
  ISBN: getIsbn()
 }
}

const book = createBook("war and peace", "sir john doe");
console.log(book.bookTitle, book.bookAuthor) // "War and Peace, Sir John Doe"

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.

Add Package

deno add jsr:@zakahacecosas/string-utils

Import symbol

import * as string_utils from "@zakahacecosas/string-utils";
or

Import directly with a jsr specifier

import * as string_utils from "jsr:@zakahacecosas/string-utils";

Add Package

pnpm i jsr:@zakahacecosas/string-utils
or (using pnpm 10.8 or older)
pnpm dlx jsr add @zakahacecosas/string-utils

Import symbol

import * as string_utils from "@zakahacecosas/string-utils";

Add Package

yarn add jsr:@zakahacecosas/string-utils
or (using Yarn 4.8 or older)
yarn dlx jsr add @zakahacecosas/string-utils

Import symbol

import * as string_utils from "@zakahacecosas/string-utils";

Add Package

vlt install jsr:@zakahacecosas/string-utils

Import symbol

import * as string_utils from "@zakahacecosas/string-utils";

Add Package

npx jsr add @zakahacecosas/string-utils

Import symbol

import * as string_utils from "@zakahacecosas/string-utils";

Add Package

bunx jsr add @zakahacecosas/string-utils

Import symbol

import * as string_utils from "@zakahacecosas/string-utils";