1.1.0 • Published 8 months ago
iconv-wordwrap v1.1.0
Iconv-Wordwrap
A wordwrap function for Iconv and Iconv-lite Buffers.
Installing
Using npm:
$ npm install iconv-wordwrap
using bun:
$ bun add iconv-wordwrap
Using yarn:
$ yarn add iconv-wordwrap
Using pnpm:
$ pnpm add iconv-wordwrap
Once the package is installed, you can import the library using default import:
import IconvWrap from "iconv-wordwrap";
Options
An options object can be passed to the function to
options.width
Type: Number
Default: 50
The width of the text before wrapping to a new line.
Example:
wrap(str, {width: 60});
options.newline
Type: Number or String
Default: \n
(two spaces)
The char to use at the end of each line.
Example:
wrap(str, {indent: '\n'});
or
wrap(str, {newline: 23});
options.space
Type: String or Number
Default: ' '
The preferred character to break lines at.
Example:
wrap(str, {space: '.'});
This project was created using bun init
in bun v1.0.1. Bun is a fast all-in-one JavaScript runtime.