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

string-kit

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-kit

A string manipulation toolbox, featuring a string formatter (inspired by sprintf), a variable inspector (output featuring ANSI colors and HTML) and various escape functions (shell argument, regexp, html, etc).

  • 0.12.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is string-kit?

string-kit is a versatile JavaScript library for string manipulation. It provides a wide range of utilities for working with strings, including formatting, padding, alignment, and more.

What are string-kit's main functionalities?

String Formatting

The `format` function allows you to format strings using placeholders, similar to printf in C. This is useful for creating dynamic strings based on variable values.

const string = require('string-kit');
console.log(string.format('%s is %d years old.', 'Alice', 30));

String Padding

The `pad` function pads a string to a specified length with a given character. This is useful for aligning text in console output or creating fixed-width string representations.

const string = require('string-kit');
console.log(string.pad('Hello', 10, ' '));

String Alignment

The `align` function aligns a string within a specified width, either left, right, or center. This is useful for formatting text in tables or other structured formats.

const string = require('string-kit');
console.log(string.align('Hello', 10, 'center', ' '));

String Truncation

The `truncate` function shortens a string to a specified length, optionally adding an ellipsis or other suffix. This is useful for displaying previews or summaries of longer text.

const string = require('string-kit');
console.log(string.truncate('This is a long string', 10));

Other packages similar to string-kit

Keywords

FAQs

Package last updated on 17 Aug 2021

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