Options
All
  • Public
  • Public/Protected
  • All
Menu

Module messaging-api-common

Index

Type aliases

OnRequestFunction

OnRequestFunction: (request: RequestPayload) => void

Type declaration

RequestPayload

RequestPayload: { body: any; headers: Record<string, string>; method?: Method; url: string }

Type declaration

  • body: any
  • headers: Record<string, string>
  • Optional method?: Method
  • url: string

Functions

camelcase

  • camelcase<T>(text: T): CamelCase<T>
  • Converts a string to camel case.

    example
    camelcase('foo_bar');
    //=> 'fooBar'

    Type parameters

    • T: string

    Parameters

    • text: T

      The input string

    Returns CamelCase<T>

    The converted string

camelcaseKeys

  • camelcaseKeys<T, O>(obj: T, options?: O): O["deep"] extends true ? CamelCasedPropertiesDeep<T> : CamelCasedProperties<T>
  • Converts object keys to camel case.

    example
    camelcaseKeys({ 'foo_bar': true });
    //=> { 'fooBar': true }

    Type parameters

    • T: PlainObject

    • O: Options

    Parameters

    • obj: T

      The input object

    • Optional options: O

      The options to config this convert function

    Returns O["deep"] extends true ? CamelCasedPropertiesDeep<T> : CamelCasedProperties<T>

    The converted object

camelcaseKeysDeep

  • camelcaseKeysDeep<T>(obj: T): CamelCasedPropertiesDeep<T>
  • Converts object keys to camel case deeply.

    example
    camelcaseKeysDeep({ 'foo_bar': { 'bar_foo': true } });
    //=> { 'fooBar': { 'barFoo': true } }

    Type parameters

    • T: PlainObject

    Parameters

    • obj: T

      The input object

    Returns CamelCasedPropertiesDeep<T>

    The converted object

createRequestInterceptor

  • createRequestInterceptor(__namedParameters?: { onRequest?: OnRequestFunction }): (config: AxiosRequestConfig) => AxiosRequestConfig

onRequest

pascalcase

  • pascalcase<T>(str: T): PascalCase<T>
  • Converts a string to pascal case.

    example
    pascalcase('fooBar');
    //=> 'FooBar'

    Type parameters

    • T: string

    Parameters

    • str: T

    Returns PascalCase<T>

    The converted string

pascalcaseKeys

  • pascalcaseKeys<T, O>(obj: T, options?: O): O["deep"] extends true ? PascalCasedPropertiesDeep<T> : PascalCasedProperties<T>
  • Converts object keys to pascal case.

    example
    pascalcaseKeys({ 'fooBar': true });
    //=> { 'FooBar': true }

    Type parameters

    • T: PlainObject

    • O: Options

    Parameters

    • obj: T

      The input object

    • Optional options: O

      The options to config this convert function

    Returns O["deep"] extends true ? PascalCasedPropertiesDeep<T> : PascalCasedProperties<T>

    The converted object

pascalcaseKeysDeep

  • pascalcaseKeysDeep<T>(obj: T): PascalCasedPropertiesDeep<T>
  • Converts object keys to pascal case deeply.

    example
    pascalcaseKeysDeep({ 'fooBar': { 'barFoo': true } });
    //=> { 'FooBar': { 'BarFoo': true } }

    Type parameters

    • T: PlainObject

    Parameters

    • obj: T

      The input object

    Returns PascalCasedPropertiesDeep<T>

    The converted object

snakecase

  • snakecase<T>(text: T): SnakeCase<T>
  • Converts a string to snake case.

    example
    snakecase('fooBar');
    //=> 'foo_bar'

    Type parameters

    • T: string

    Parameters

    • text: T

      The input string

    Returns SnakeCase<T>

    The converted string

snakecaseKeys

  • snakecaseKeys<T, O>(obj: T, options?: O): O["deep"] extends true ? SnakeCasedPropertiesDeep<T> : SnakeCasedProperties<T>
  • Converts object keys to snake case.

    example
    snakecaseKeys({ 'fooBar': true });
    //=> { 'foo_bar': true }

    Type parameters

    • T: PlainObject

    • O: Options

    Parameters

    • obj: T

      The input object

    • Optional options: O

      The options to config this convert function

    Returns O["deep"] extends true ? SnakeCasedPropertiesDeep<T> : SnakeCasedProperties<T>

    The converted object

snakecaseKeysDeep

  • snakecaseKeysDeep<T>(obj: T): SnakeCasedPropertiesDeep<T>
  • Converts object keys to snake case deeply.

    example
    snakecaseKeysDeep({ 'fooBar': { 'barFoo': true } });
    //=> { 'foo_bar': { 'bar_foo': true } }

    Type parameters

    • T: PlainObject

    Parameters

    • obj: T

      The input object

    Returns SnakeCasedPropertiesDeep<T>

    The converted object

Generated using TypeDoc