Skip to content

qxie11/tiny-string-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny-string-utils

A lightweight, zero-dependency library for common string manipulations.

Installation

npm install tiny-string-utils

Usage

import { capitalize, slugify, camelCase, truncate } from 'tiny-string-utils';

capitalize('hello');         // 'Hello'
slugify('Hello World!');     // 'hello-world'
camelCase('foo-bar-baz');    // 'fooBarBaz'
truncate('Long text...', 8); // 'Long...'

Available Functions

  • capitalize(str) — Capitalize the first letter
  • slugify(str) — Convert to URL-friendly slug
  • truncate(str, length, suffix?) — Truncate with suffix
  • camelCase(str) — Convert to camelCase
  • kebabCase(str) — Convert to kebab-case
  • snakeCase(str) — Convert to snake_case
  • reverse(str) — Reverse a string
  • countWords(str) — Count words
  • stripWhitespace(str) — Remove all whitespace
  • isPalindrome(str) — Check if palindrome
  • padCenter(str, length, char?) — Center-pad a string
  • repeat(str, count, separator?) — Repeat a string

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors