Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "string/code-point-at/docs/types/index.d"

Index

Functions

Functions

Export assignment codePointAt

  • codePointAt(str: string, idx: number, backward?: undefined | false | true): number
  • Returns a Unicode code point from a string at specified position.

    throws

    first argument must be a string

    throws

    second argument must be a nonnegative integer

    throws

    third argument must be a boolean

    throws

    position must be a valid index in string

    Parameters

    • str: string

      input string

    • idx: number

      position

    • Optional backward: undefined | false | true

      backward iteration for low surrogates (default: false)

    Returns number

    code point

    Example

    var str = codePointAt( 'अनुच्छेद', 2 );
    // returns 2369
    
    str = codePointAt( '🌷', 1, true );
    // returns 127799