Options
All
  • Public
  • Public/Protected
  • All
Menu

Package util

Sus | Among JS

General utilities for reading bytes and more. This is part of Among JS, a simple and flexible library for interacting with the Among Us protocol.

Index

Functions

Const lerp

  • lerp(min: number, max: number, value: number): number
  • Linearly interpolate a number between 0 and 1 to be between the lower and upper bound. See unlerp for the opposite of this.

    Parameters

    • min: number

      Lower bound

    • max: number

      Upper bound

    • value: number

      Value to lerp

    Returns number

Const pack

  • pack(value: number): Buffer
  • Pack a number into the smallest number of bytes possible.

    remarks

    See the wiki page on packing for more information on this process.

    Parameters

    • value: number

      Number to pack

    Returns Buffer

Const readPacked

  • readPacked(bb: ByteBuffer): number
  • Read and return a packed number from a buffer, incrementing the offset by the number of bytes.

    remarks

    See the wiki page on packing for more information on this process.

    Parameters

    • bb: ByteBuffer

      Buffer to read from

    Returns number

Const unlerp

  • unlerp(min: number, max: number, value: number): number
  • Reverse of lerp. Takes a value between the lower and upper bound and maps it to a number between 0 and 1.

    Parameters

    • min: number

      Lower bound

    • max: number

      Upper bound

    • value: number

      Value to unlerp

    Returns number

Const v2CodeToNumber

  • v2CodeToNumber(code: string): number
  • Converts a V2 game code into its number form.

    Parameters

    • code: string

      Game code as a string

    Returns number

Const v2NumberToCode

  • v2NumberToCode(code: number): string
  • Converts a V2 game code as a number into a human-readable string

    Parameters

    • code: number

      Game code as a number

    Returns string

Generated using TypeDoc