Expand all

unicodeJS.wordbreak

Methods

getProperty(codepoint) → {string|null}privatestatic #

Return the wordbreak property value for the codepoint

See http://www.unicode.org/reports/tr29/#Word_Boundaries

Parameters:

Name Type Description
codepoint string

The codepoint

Source:

Returns:

The unicode wordbreak property value (key of unicodeJS.wordbreakproperties)

Type
string | null

wordbreak.isBreak(string, pos) → {boolean}static #

Evaluates whether a position within some text is a word boundary.

The text object elements may be codepoints or code units

Parameters:

Name Type Description
string unicodeJS.TextString

TextString

pos number

Character position

Source:

Returns:

Is the position a word boundary

Type
boolean

wordbreak.moveBreakOffset(direction, string, pos, [onlyAlphaNumeric]) → {number}static #

Find the next word break offset in a specified direction.

Parameters:

Name Type Attributes Default Description
direction number

Direction to search in, should be plus or minus one

string unicodeJS.TextString

TextString

pos number

Character position

onlyAlphaNumeric boolean optional
false

When set, ignores a break if the previous character is not alphaNumeric

Source:

Returns:

Returns the previous offset which is word break

Type
number

wordbreak.nextBreakOffset(string, pos, [onlyAlphaNumeric]) → {number}static #

Find the next word break offset.

Parameters:

Name Type Attributes Default Description
string unicodeJS.TextString

TextString

pos number

Character position

onlyAlphaNumeric boolean optional
false

When set, ignores a break if the previous character is not alphaNumeric

Source:

Returns:

Returns the next offset which is a word break

Type
number

wordbreak.prevBreakOffset(string, pos, [onlyAlphaNumeric]) → {number}static #

Find the previous word break offset.

Parameters:

Name Type Attributes Default Description
string unicodeJS.TextString

TextString

pos number

Character position

onlyAlphaNumeric boolean optional
false

When set, ignores a break if the previous character is not alphaNumeric

Source:

Returns:

Returns the previous offset which is a word break

Type
number