Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IStringBreakOpt

Options for stringBreaker

Example to split string contains elemets of 10

const opt: IStringBreakOpt = { width: 10 }

Example to split string contains elemets of 40 and encode line endings into \n

const opt: IStringBreakOpt = {
  width: 40,
  lnEnd: lnEndOpt.encode
 }

Example to split string contains elemets of 40 and keep Byte order mark if it exist

const opt: IStringBreakOpt = {
  width: 40,
  noBOM: false
 }

Example to split string contains one element per line

const opt: IStringBreakOpt = { splitOpt: splitByOpt.line }

Example to split string contains one element per word

const opt: IStringBreakOpt = { splitOpt: splitByOpt.word }

Example to split string contains elemets base up if the character is fullwidth or halfwidth.

Fullwidth chars would take up two positions in the element.

Halfwidth chars would take up one postion in the element.

const opt: IStringBreakOpt = {
  width: 40,
  lenOpt: widthFlags.fullwidth
 }

Example to split string contains elemets base up if the character is a surrogate pair.

Surrogate pair chars would take up two positions in the element.

const opt: IStringBreakOpt = {
  width: 40,
  lenOpt: widthFlags.surrogatePair
 }

Example to split string contains elemets base up if the character is fullwidth, halfwidth or surrogate pair.

Fullwidth chars would take up two positions in the element.

Halfwidth chars would take up one postion in the element.

Surrogate pair chars would take up two positions in the element.

const opt: IStringBreakOpt = {
  width: 100,
  lenOpt: widthFlags.fullwidth | widthFlags.surrogatePair
 }

Hierarchy

  • IStringBreakOpt

Index

Properties

Optional lenOpt

lenOpt: widthFlags

Flags for Width output options

Optional lnEnd

lnEnd: lnEndOpt

Options for line endings

Optional noBOM

noBOM: undefined | false | true

If false and input string has BOM then the BOM will be added as the first byte of output. BOM will not be counted in the width of the first line. If false the return value will not have BOM included. Default true

Optional noExSp

noExSp: undefined | false | true

If true extra spaces will be removed from the output. Default false

Optional splitOpt

splitOpt: splitByOpt

Option to break string. Width, word, eol

Optional width

width: undefined | number

Width to break string at. Default 80

Generated using TypeDoc