Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
decreased by-4.8%
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

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

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