Socket
Socket
Sign inDemoInstall

wordwrapjs

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wordwrapjs

Word-wrapping for javascript.


Version published
Weekly downloads
1.7M
decreased by-2.14%
Maintainers
1
Weekly downloads
 
Created

What is wordwrapjs?

The wordwrapjs package is a utility for wrapping words into a specified width. It's useful for formatting text output in command-line applications or anywhere where you need to control the flow of text to fit within certain boundaries.

What are wordwrapjs's main functionalities?

Hard Wrapping

Hard wrapping ensures that the text is wrapped strictly at the specified width, even if it means breaking words apart.

const wordwrap = require('wordwrapjs');
let wrappedText = wordwrap.wrap('Some long text that needs to be wrapped', {width: 20});
console.log(wrappedText);

Soft Wrapping

Soft wrapping wraps text at the specified width but without breaking words. It moves the whole word to the next line if it doesn't fit.

const wordwrap = require('wordwrapjs');
let wrappedText = wordwrap.wrap('Some long text that needs to be wrapped', {width: 20, break: false});
console.log(wrappedText);

Custom Break Character

This feature allows specifying a custom break character for wrapping, which can be useful for adding hyphens or other characters when a word is split.

const wordwrap = require('wordwrapjs');
let wrappedText = wordwrap.wrap('Some long text that needs to be wrapped', {width: 20, break: true, cut: true});
console.log(wrappedText);

Other packages similar to wordwrapjs

Keywords

FAQs

Package last updated on 20 Nov 2016

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