Options
All
  • Public
  • Public/Protected
  • All
Menu

Enumeration widthFlags

Flags for Width output options

example

let wFlags = widthFlags.fullwidth | widthFlags.surrogatePair;
see

IStringBreakOpt

Index

Enumeration members

Enumeration members

fullwidth

fullwidth: = 1 << 0

Fullwidth chars will count for two positions

see

https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms

nearestWord

nearestWord: = 1 << 2

When split using width and this flag is set then the elements in the array will split where there is a whitespace and not before. If the whitespace is a printing char as in the case of \u1680 then it will be include at the end of the element: Otherwise the whitespace is removed from the end of the element;

 
Elemnets will not start with a whitespace unless that whitespace happens to be a printalbe whitespace such as \u1680. For practical purposes all lines will not start with a whitespace.
example

var str = 'On this\u1680day.\u1680For this morning, when Gregor\u3000Samsa woke from troubled dreams; he found himself transformed.';
const result: string[] = stringBreaker(str, { width: 10, lenOpt: widthFlags.nearestWord });
const strResult = result.join('\n');
console.log(strResult);
On this day. 
For this morning,
when Gregor
Samsa woke
from troubled
dreams; he
found himself
transformed.

none

none: = 0

No options will be applied

surrogatePair

surrogatePair: = 1 << 1

Surrogae Pairs will count for two positions

see

https://en.wikipedia.org/wiki/UTF-16

Generated using TypeDoc