Library line-wrap

To use this library in your code:

import line-wrap

Functions

line-wrap text/string max-width/num [--compute-width] [--can-split] -> List
See line-wrap text max-width [--compute-width] [--can-split] [--is-space]. Trims space (0x20) characters around wrap points.

line-wrap text/string max-width/num [--compute-width] [--can-split] [--is-space] -> List
Wraps a line of text to a given max-width, and returns the resulting lines, trimming whitespace characters around wrap points. The compute-width block takes a string, a from-position and a to-position (non-inclusive) and returns the width. The can-split block takes a string and a position, and returns true if we can split at that point. The is-space block takes an integer code point and returns true if it should be trimmed.