New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@utilify/string

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@utilify/string

The string utility functions provide a variety of methods for text manipulation, such as transforming, counting words, sanitizing, and formatting strings.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

String Utilities

The string utility functions provide a variety of methods for text manipulation, such as transforming, counting words, sanitizing, and formatting strings.

Installation

To install the string utilities package, use one of the following commands, depending on your package manager:

npm install @utilify/string
yarn add @utilify/string
pnpm add @utilify/string

Once installed, you can import the functions into your project, using ESM or CJS.

import { capitalize, invertCase, maskString, isUpperCase, isLowerCase } from '@utilify/string';
const { capitalize, invertCase, maskString, isUpperCase, isLowerCase } = require('@utilify/string');

Overview

Here is an overview of the available functions in the string utilities package:

capitalize

function capitalize(str: string): string

Capitalizes the first letter of a string.

invertCase

function invertCase(str: string): string

Inverts the case of each character in a string.

isLowerCase

function isLowerCase(str: string): boolean

Checks if the string is in lowercase.

isUpperCase

function isUpperCase(str: string): boolean

Checks if the string is in uppercase.

maskString

function maskString(str: string, maskStart: number, maskEnd: number, mask: string = '*'): string

Replaces a portion of the string with a mask character.

removeAccents

function removeAccents(str: string): string

Removes accents from a string.

slugify

function slugify(str: string): string

Transforms a string into a URL-friendly format (slug).

toCamelCase

function toCamelCase(str: string): string

Transforms a string into camelCase format.

toKebabCase

function toKebabCase(str: string): string

Transforms a string into kebab-case format.

toPascalCase

function toPascalCase(str: string): string

Transforms a string into PascalCase format.

toSnakeCase

function toSnakeCase(str: string): string

Transforms a string into snake_case format.

truncate

function truncate(text: string, size: number): string

Truncates a string to a specific size and adds "..." at the end.

wordCount

function wordCount(str: string): number

Counts the number of words in a string.

Keywords

string

FAQs

Package last updated on 12 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts