2.0.0 • Published 5 months ago

@cto.af/linewrap v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 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

5 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago