Options
All
  • Public
  • Public/Protected
  • All
Menu

estr

estr - Essential String Toolkit for Unicode.

Index

Enumerations

Classes

Interfaces

Variables

Functions

Variables

AI

AI: number

AL

AL: number

Const ALPHABETICS

ALPHABETICS: number[] = [AL, HL]

B2

B2: number

BA

BA: number

Const BAD_UTF8_DATA_OFFSET

BAD_UTF8_DATA_OFFSET: 128 = 128

BB

BB: number

BK

BK: number

Const CATEGORY_BITS

CATEGORY_BITS: number = bits(commonPropsMeta.categories.length - 1)

Const CATEGORY_MASK

CATEGORY_MASK: number = (1 << CATEGORY_BITS) - 1

Const CATEGORY_SHIFT

CATEGORY_SHIFT: number = COMBINING_BITS + SCRIPT_BITS + EAW_BITS + NUMBER_BITS

CB

CB: number

CJ

CJ: number

CL

CL: number

CM

CM: number

Const COMBINING_BITS

COMBINING_BITS: number = bits(commonPropsMeta.combiningClasses.length - 1)

Const COMBINING_MASK

COMBINING_MASK: number = (1 << COMBINING_BITS) - 1

Const COMBINING_SHIFT

COMBINING_SHIFT: number = SCRIPT_BITS + EAW_BITS + NUMBER_BITS

CP

CP: number

Const CP_PER_INDEX_1_ENTRY

CP_PER_INDEX_1_ENTRY: number = 1 << SHIFT_1

CR

CR: number

Control

Control: number

Const DATA_0800_OFFSET

DATA_0800_OFFSET: number = NEW_DATA_START_OFFSET + 0x780

Const DATA_BLOCK_LENGTH

DATA_BLOCK_LENGTH: number = 1 << SHIFT_2

Const DATA_GRANULARITY

DATA_GRANULARITY: number = 1 << INDEX_SHIFT

Const DATA_MASK

DATA_MASK: number = DATA_BLOCK_LENGTH - 1

Const DATA_NULL_OFFSET

DATA_NULL_OFFSET: 192 = DATA_START_OFFSET

Const DATA_START_OFFSET

DATA_START_OFFSET: 192 = 192

Const EAW_BITS

EAW_BITS: number = bits(commonPropsMeta.eastAsiaWidths.length - 1)

Const EAW_MASK

EAW_MASK: number = (1 << EAW_BITS) - 1

Const EAW_SHIFT

EAW_SHIFT: 10 = NUMBER_BITS

EB

EB: number

EM

EM: number

EX

EX: number

Extend

Extend: number

GL

GL: number

H2

H2: number

H3

H3: number

Const HARD_LINE_BREAKS

HARD_LINE_BREAKS: number[] = [BK, CR, LF, NL]

HL

HL: number

HY

HY: number

Const HYPHEN

HYPHEN: number[] = [HY, BA]

ID

ID: number

IN

IN: number

Const INDEX_1_LENGTH

INDEX_1_LENGTH: number = 0x110000 >> SHIFT_1

Const INDEX_1_OFFSET

INDEX_1_OFFSET: number = UTF8_2B_INDEX_2_OFFSET + UTF8_2B_INDEX_2_LENGTH

Const INDEX_2_BLOCK_LENGTH

INDEX_2_BLOCK_LENGTH: number = 1 << SHIFT_1_2

Const INDEX_2_BMP_LENGTH

INDEX_2_BMP_LENGTH: number = LSCP_INDEX_2_OFFSET + LSCP_INDEX_2_LENGTH

Const INDEX_2_MASK

INDEX_2_MASK: number = INDEX_2_BLOCK_LENGTH - 1

Const INDEX_2_NULL_OFFSET

INDEX_2_NULL_OFFSET: number = INDEX_GAP_OFFSET + INDEX_GAP_LENGTH

Const INDEX_2_OFFSET

INDEX_2_OFFSET: 0 = 0

Const INDEX_2_START_OFFSET

INDEX_2_START_OFFSET: number = INDEX_2_NULL_OFFSET + INDEX_2_BLOCK_LENGTH

Const INDEX_GAP_LENGTH

INDEX_GAP_LENGTH: number = (UTF8_2B_INDEX_2_LENGTH + MAX_INDEX_1_LENGTH + INDEX_2_MASK) & ~INDEX_2_MASK

Const INDEX_GAP_OFFSET

INDEX_GAP_OFFSET: number = INDEX_2_BMP_LENGTH

Const INDEX_SHIFT

INDEX_SHIFT: 2 = 2

Const INITIAL_DATA_LENGTH

INITIAL_DATA_LENGTH: number = 1 << 14

IS

IS: number

JL

JL: number

JT

JT: number

JV

JV: number

Const KOREAN_SYLLABLE_BLOCK

KOREAN_SYLLABLE_BLOCK: number[] = [JL, JV, JT, H2, H3]

L

L: number

LF

LF: number

Const LINE_BREAKS

LINE_BREAKS: number[] = HARD_LINE_BREAKS.concat(SPACE, ZW)

Const LSCP_INDEX_2_LENGTH

LSCP_INDEX_2_LENGTH: number = 0x400 >> SHIFT_2

Const LSCP_INDEX_2_OFFSET

LSCP_INDEX_2_OFFSET: number = 0x10000 >> SHIFT_2

LV

LV: number

LVT

LVT: number

Let MAX_DATA_LENGTH

MAX_DATA_LENGTH: number = 0xffff << INDEX_SHIFT

Const MAX_INDEX_1_LENGTH

MAX_INDEX_1_LENGTH: number = 0x100000 >> SHIFT_1

Const MAX_INDEX_2_LENGTH

MAX_INDEX_2_LENGTH: number = (0x110000 >> SHIFT_2) +LSCP_INDEX_2_LENGTH +INDEX_GAP_LENGTH +INDEX_2_BLOCK_LENGTH

Const MAX_INDEX_LENGTH

MAX_INDEX_LENGTH: 65535 = 65535

Const MEDIUM_DATA_LENGTH

MEDIUM_DATA_LENGTH: number = 1 << 17

Const NEW_DATA_START_OFFSET

NEW_DATA_START_OFFSET: number = DATA_NULL_OFFSET + 0x40

NL

NL: number

NS

NS: number

NU

NU: number

Const NUMBER_BITS

NUMBER_BITS: 10 = 10

Const NUMBER_MASK

NUMBER_MASK: number = (1 << NUMBER_BITS) - 1

Const OMITTED_BMP_INDEX_1_LENGTH

OMITTED_BMP_INDEX_1_LENGTH: number = 0x10000 >> SHIFT_1

OP

OP: number

Other

Other: number

PO

PO: number

PR

PR: number

Const PREFIX_POSTFIX

PREFIX_POSTFIX: number[] = [PR, PO]

Prepend

Prepend: number

QU

QU: number

RI

RI: number

Regional_Indicator

Regional_Indicator: number

SA

SA: number

Const SCRIPT_BITS

SCRIPT_BITS: number = bits(commonPropsMeta.scripts.length - 1)

Const SCRIPT_MASK

SCRIPT_MASK: number = (1 << SCRIPT_BITS) - 1

Const SCRIPT_SHIFT

SCRIPT_SHIFT: number = EAW_BITS + NUMBER_BITS

SG

SG: number

Const SHIFT_1

SHIFT_1: number = 6 + 5

Const SHIFT_1_2

SHIFT_1_2: number = SHIFT_1 - SHIFT_2

Const SHIFT_2

SHIFT_2: 5 = 5

SP

SP: number

Const SPACE

SPACE: number[] = [SP, ZW]

SY

SY: number

SpacingMark

SpacingMark: number

T

T: number

Const UTF8_2B_INDEX_2_LENGTH

UTF8_2B_INDEX_2_LENGTH: number = 0x800 >> 6

Const UTF8_2B_INDEX_2_OFFSET

UTF8_2B_INDEX_2_OFFSET: number = INDEX_2_BMP_LENGTH

V

V: number

WJ

WJ: number

XX

XX: number

ZW

ZW: number

ZWJ

ZWJ: number

Const commonPropsMeta

commonPropsMeta: any = JSON.parse(fs.readFileSync(__dirname + '/ucd/common_props.json', 'ascii'))

Const commonPropsTrie

commonPropsTrie: UnicodeTrie = new UnicodeTrie(fs.readFileSync(__dirname + '/ucd/common_props.trie'))

Const emojiDataTrie

emojiDataTrie: UnicodeTrie = new UnicodeTrie(fs.readFileSync(__dirname + '/ucd/emoji_data.trie'))

Let emojiShift

emojiShift: object = emojiShiftMeta

Type declaration

  • [key: string]: number

Const fs

fs: any = require('fs')

File: src/unicode_emoji_data.ts Project: estr Created Date: Thursday, December 13 2018, 2:08:44 PM

Author: billbai billbai42@gmail.com

Copyright (c) 2018 billbai File: src/grapheme_breaker.ts Project: estr Created Date: Thursday, December 13 2018, 2:08:02 PM

Author: billbai billbai42@gmail.com

Copyright (c) 2018 billbai File: src/unicode_common_property.ts Project: estr Created Date: Thursday, December 13 2018, 2:08:35 PM

Author: billbai billbai42@gmail.com

Copyright (c) 2018 billbai File: src/line_breaker.ts Project: estr Created Date: Thursday, December 13 2018, 2:08:13 PM

Author: billbai billbai42@gmail.com

Copyright (c) 2018 billbai

Const graphemeBreakTrie

graphemeBreakTrie: UnicodeTrie = new UnicodeTrie(fs.readFileSync(__dirname + '/ucd/grapheme_break.trie'))

Let graphemeClass

graphemeClass: object = graphemeClassMeta

Type declaration

  • [key: string]: number

Const isEmojiComponentMask

isEmojiComponentMask: number = 1 << isEmojiComponentShift

isEmojiComponentShift

isEmojiComponentShift: number

Const isEmojiMask

isEmojiMask: number = 1 << isEmojiShift

Const isEmojiModifierBaseMask

isEmojiModifierBaseMask: number = 1 << isEmojiModifierBaseShift

isEmojiModifierBaseShift

isEmojiModifierBaseShift: number

Const isEmojiModifierMask

isEmojiModifierMask: number = 1 << isEmojiModifierShift

isEmojiModifierShift

isEmojiModifierShift: number

Const isEmojiPresentationMask

isEmojiPresentationMask: number = 1 << isEmojiPresentationShift

isEmojiPresentationShift

isEmojiPresentationShift: number

isEmojiShift

isEmojiShift: number

Const isExtPictographicMask

isExtPictographicMask: number = 1 << isExtPictographicShift

isExtPictographicShift

isExtPictographicShift: number

Let lineBreakClasses

lineBreakClasses: object = lineBreakMeta

Type declaration

  • [key: string]: number

Const lineBreakTrie

lineBreakTrie: UnicodeTrie = new UnicodeTrie(fs.readFileSync(__dirname + '/ucd/line_break.trie'))

Const log2

log2: log2 = Math.log2 || ((n: number) => Math.log(n) / Math.LN2)

Const pako

pako: any = require('pako')

File: src/unicode_trie_builder.ts Project: estr Created Date: Thursday, December 13 2018, 2:09:01 PM

Author: billbai billbai42@gmail.com

Copyright (c) 2018 billbai

Const tinyInflate

tinyInflate: any = require('tiny-inflate')

File: src/unicode_trie.ts Project: estr Created Date: Thursday, December 13 2018, 2:08:52 PM

Author: billbai billbai42@gmail.com

Copyright (c) 2018 billbai

Functions

_cssFormattedClasses

  • _cssFormattedClasses(codePoints: number[], options: Options | null): [number[], number[], boolean[] | null]
  • Parameters

    • codePoints: number[]
    • options: Options | null

    Returns [number[], number[], boolean[] | null]

_isAdjacentWithSpaceIgnored

  • _isAdjacentWithSpaceIgnored(a: number[] | number, b: number, currentIndex: number, classTypes: number[]): boolean
  • Parameters

    • a: number[] | number
    • b: number
    • currentIndex: number
    • classTypes: number[]

    Returns boolean

_isLetterNumber

  • _isLetterNumber(category: string): boolean

_lineBreakAtIndex

  • _lineBreakAtIndex(codePoints: number[], classTypes: number[], indicies: number[], index: number, forbiddenBreaks?: boolean[] | null): LineBreakType
  • Parameters

    • codePoints: number[]
    • classTypes: number[]
    • indicies: number[]
    • index: number
    • Default value forbiddenBreaks: boolean[] | null = null

    Returns LineBreakType

_previousNonCMOrZWJClassType

  • _previousNonCMOrZWJClassType(currentIndex: number, classTypes: Array<number>): number
  • Parameters

    • currentIndex: number
    • classTypes: Array<number>

    Returns number

_previousNonSpaceClassType

  • _previousNonSpaceClassType(currentIndex: number, classTypes: Array<number>): number
  • Parameters

    • currentIndex: number
    • classTypes: Array<number>

    Returns number

Const bits

  • bits(n: number): number

breakByGrapheme

  • breakByGrapheme(str: string): string[]
  • split the str into grapheme clusters

    Parameters

    • str: string

    Returns string[]

    an array of string, each string represents a grapheme cluester

codePointAt

  • codePointAt(str: string, idx: number): number
  • File: src/util.ts Project: estr Created Date: Thursday, December 13 2018, 2:09:40 PM

    Author: billbai billbai42@gmail.com

    Copyright (c) 2018 billbai

    Parameters

    • str: string
    • idx: number

    Returns number

codePointsToLineBreakClasses

  • codePointsToLineBreakClasses(codePoints: number[], lineBreakOption?: LineBreakOption): [number[], number[], boolean[]]
  • convert code points to line break classes accordingly

    Parameters

    • codePoints: number[]

      the code points

    • Default value lineBreakOption: LineBreakOption = LineBreakOption.Strict

    Returns [number[], number[], boolean[]]

equal_int

  • equal_int(a: Uint32Array | Int32Array, s: number, t: number, length: number): boolean

fromCodePoints

  • fromCodePoints(...codePoints: number[]): string
  • Parameters

    • Rest ...codePoints: number[]

    Returns string

Const getCategory

  • getCategory(codePoint: number): any

Const getCombiningClass

  • getCombiningClass(codePoint: number): any

Const getEastAsianWidth

  • getEastAsianWidth(codePoint: number): any

Const getNumericValue

  • getNumericValue(codePoint: number): number

Const getScript

  • getScript(codePoint: number): any

graphemeCount

  • graphemeCount(str: string): number

Const isAlphabetic

  • isAlphabetic(codePoint: number): boolean

Const isBaseForm

  • isBaseForm(codePoint: number): boolean

Const isDigit

  • isDigit(codePoint: number): boolean

isEmoji

  • isEmoji(codePoint: number): boolean

isEmojiComponent

  • isEmojiComponent(codePoint: number): boolean

isEmojiModifier

  • isEmojiModifier(codePoint: number): boolean

isEmojiModifierBase

  • isEmojiModifierBase(codePoint: number): boolean

isEmojiPresentation

  • isEmojiPresentation(codePoint: number): boolean

isExtPictographic

  • isExtPictographic(codePoint: number): boolean

isHighSurrogate

  • isHighSurrogate(charCode: number): boolean
  • Parameters

    • charCode: number

    Returns boolean

isLowSurrogate

  • isLowSurrogate(charCode: number): boolean
  • Parameters

    • charCode: number

    Returns boolean

Const isLowerCase

  • isLowerCase(codePoint: number): boolean

Const isMark

  • isMark(codePoint: number): boolean

Const isPunctuation

  • isPunctuation(codePoint: number): boolean

Const isTitleCase

  • isTitleCase(codePoint: number): boolean

Const isUpperCase

  • isUpperCase(codePoint: number): boolean

Const isWhiteSpace

  • isWhiteSpace(codePoint: number): boolean

lineBreakAtIndex

nextBreak

  • nextBreak(str: string, idx?: number): number
  • find next grapheme point index (char code index) after idx (idx itself is not included)

    Parameters

    • str: string
    • Default value idx: number = 0

    Returns number

previousBreak

  • previousBreak(str: string, idx?: number): number
  • find previous grapheme break point (char code index) before idx (idx itself is not included)

    Parameters

    • str: string
    • Default value idx: number = 0

    Returns number

shouldBreak

  • shouldBreak(headProps: [number, boolean][], previousProp: [number, boolean], currentProp: [number, boolean]): boolean
  • Parameters

    • headProps: [number, boolean][]
    • previousProp: [number, boolean]
    • currentProp: [number, boolean]

    Returns boolean

toCodePoints

  • toCodePoints(str: string): number[]
  • Parameters

    • str: string

    Returns number[]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc