New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

underscore.string

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

underscore.string

String manipulation extensions for Underscore.js javascript library.

3.1.0
Source
npm
Version published
Weekly downloads
2M
5.13%
Maintainers
4
Weekly downloads
 
Created

What is underscore.string?

The underscore.string npm package provides utility functions for string manipulation, including functions for trimming, padding, converting case, and more. It extends the functionality of Underscore.js, a JavaScript library that provides functional programming helpers, to work with strings.

What are underscore.string's main functionalities?

String Trimming

Removes whitespace from both ends of a string.

" Hello world! ".trim(); // 'Hello world!'

Case Conversion

Converts dash or underscore delimited strings into camelCase.

_.str.camelize('moz-transform'); // 'mozTransform'

String Padding

Pads the string with characters until the total string length is equal to the passed length parameter.

_.str.pad('1', 8, '0'); // '00000001'

String Truncation

Truncates the string securely, not cutting words in half, and appending an ellipsis if the string was truncated.

_.str.prune('Hello, world', 5); // 'Hello...'

Number Formatting

Formats a number with grouped thousands and a specific number of decimal places.

_.str.numberFormat(1000, 2); // '1,000.00'

Other packages similar to underscore.string

Keywords

underscore

FAQs

Package last updated on 05 Jun 2015

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