Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@full-pack/string-pack

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@full-pack/string-pack

A lightweight and versatile String Utility Package for Node.js & Browser.

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

@full-pack/string-pack

npm

jest Code Style: Prettier

A lightweight and versatile String Utility Package for Node.js & Browser.

Contents

install

npm install @full-pack/string-pack

require

const { ... } = require('@full-pack/string-pack');

import

import { ... } from '@full-pack/string-pack';

API

padding

Adds padding to given string.

padStart

Pads the start of a string with a specified fill string a certain number of times.

// Basic Usage
padStart('hello', 'abc', 3) // abcabcabchello

// Limiting total length
padStart('hello', 'abc', 3, 8) // abchello
padEnd

Pads the end of a string with a specified fill string a certain number of times.

// Basic Usage
padEnd('hello', 'abc', 3); // helloabcabcabc

// Limiting total length
padEnd('hello', 'abc', 3, 8); // helloabc
padBidirectional

Pads a string with a specified fill string a certain number of times on both ends.

// Basic usage
padBidirectional('hello', '*', 2); // '**hello**'

// Limiting total length
padBidirectional('world', '-', 3, 10); // '--world---'
 
// Controlling padding distribution
padBidirectional('example', '*', 2, 10, 0); // '**example*'

merge

Merges an array of strings into a single string using a specified separator.

merge('-', 'apple', 'orange', 'banana'); // 'apple-orange-banana'

merge(true, 'apple', 'orange'); // 'apple orange'
 
merge(false, 'apple', 'orange', 'banana'); // 'appleorangebanana'

compare

Performs a strict comparison between two strings.

compare("hello", "hello"); // true

compare("abc", "ABC"); // false

looseCompare

Performs a case-insensitive loose comparison between two strings.

looseCompare("hello", "HELLO"); // true

looseCompare("abc", "123"); // false

capitalizeInitial

Capitalizes the first letter of a word in a string.

capitalizeInitial('hello'); // 'Hello'

capitalizeInitial(':> hello');  // ':> Hello'

capitalizeWords

Capitalizes the first letter of each word in a given string.

capitalizeWords('hello world'); // 'Hello World'

capitalizeWords('Sphinx of black quartz:-judge my vow'); // 'Sphinx Of Black Quartz:-Judge My Vow'

Build

npm run build

License

The MIT License. Full License is here

Keywords

FAQs

Package last updated on 26 Mar 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc