unicodeJS.wordbreak

Show:

Methods

(private, static) getProperty(codepoint) → {string|null}

...

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

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

...

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

(static) wordbreak.moveBreakOffset(direction, string, pos, onlyAlphaNumericopt) → {number}

...

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

(static) wordbreak.nextBreakOffset(string, pos, onlyAlphaNumericopt) → {number}

...

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

(static) wordbreak.prevBreakOffset(string, pos, onlyAlphaNumericopt) → {number}

...

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