2.0.0 • Published 2 months ago

@cto.af/linewrap v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@cto.af/linewrap

Wrap lines using Unicode UAX #14 line breaking rules.

Installation

npm install @cto.af/linewrap

CLI

A command line interface is available: @cto.af/linewrap-cli

API

import {LineWrap} from '@cto.af/linewrap'
const w = new LineWrap()
w.wrap('Lorem ipsum dolor sit amet...')  // A string, wrapped to your console length
for (const line of w.lines('Lorem ipsum dolor sit amet...')) {
  // `line` does not have a newline at the end
}

Full API docs are available.

Methods

Options

Options may be passed into the constructor in an object:

const w = new LineWrap({ width: 40 })

The following options are all optional, having the specified defaults:

Visual representation of options

Visual depiction of linewrap options


Tests codecov

2.0.0

2 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago