Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "util"

Index

Type aliases

Component

Component: object

Type declaration

Forceable

Forceable: T & object

Variables

Const FORCE_NEW

FORCE_NEW: unique symbol = Symbol('force-new')

Const kSingleton

kSingleton: unique symbol = Symbol()

Functions

createStackTrace

  • createStackTrace(numFrames: number, skipFrames: number, constructorOpt?: Function): StackFrame[]
  • Creates a StackFrame object containing a structured stack trace.

    Parameters

    • numFrames: number

      The number of frames to retain.

    • skipFrames: number

      The number of top-most frames to remove.

    • Optional constructorOpt: Function

      A function passed to Error.captureStackTrace, which causes it to ignore the frames above the top-most call to this function.

    Returns StackFrame[]

generateTraceContext

  • Generates a trace context header value that can be used to follow the associated request through other Google services.

    Parameters

    • traceContext: TraceContext

      An object with information sufficient for creating a serialized trace context.

    Returns string

packageNameFromPath

  • packageNameFromPath(importPath: string): null | string
  • Retrieves a package name from the full import path. For example: './node_modules/bar/index/foo.js' => 'bar'

    Parameters

    • importPath: string

    Returns null | string

parseContextFromHeader

  • Parse a cookie-style header string to extract traceId, spandId and options ex: '123456/667;o=3' -> {traceId: '123456', spanId: '667', options: '3'} note that we ignore trailing garbage if there is more than one '=' Returns null if traceId or spanId could not be found.

    Parameters

    • str: string

      string representation of the trace headers

    Returns TraceContext | null

    object with keys. null if there is a problem.

truncate

  • truncate(str: string, length: number): string
  • Truncates the provided string to be at most length bytes after utf8 encoding and the appending of '...'. We produce the result by iterating over input characters to avoid truncating the string potentially producing partial unicode characters at the end.

    Parameters

    • str: string
    • length: number

    Returns string

Generated using TypeDoc