Options
All
  • Public
  • Public/Protected
  • All
Menu

External module Utils

Index

Functions

Private compareArrays

  • compareArrays(arr1: string[], arr2: string[]): string[]
  • Finds the matching strings between two arrays

    Parameters

    • arr1: string[]

      The first array

    • arr2: string[]

      The second array

    Returns string[]

    The shared strings between the arrays

Private jsonfy

  • jsonfy(xml: string): Promise<object[]>
  • Parses xml to json, which can be used with js

    Parameters

    • xml: string

      The xml to convert to json

    Returns Promise<object[]>

    A Promise with an array of objects created from the xml

Private randInt

  • randInt(min: number, max: number): number
  • Generate a random int between [min, max]

    Parameters

    • min: number

      The minimum (inclusive)

    • max: number

      The maximum (inclusive)

    Returns number

resolveSite

  • resolveSite(domain: string): string | null
  • Check if site is a supported site (and check if it's an alias and return the sites's true name)

    Parameters

    • domain: string

      The site to resolveSite

    Returns string | null

    null if site is not supported, the site otherwise

Private shuffle

  • shuffle<T>(array: T[]): T[]

Private validateSearchParams

  • validateSearchParams(site: string, limit: number | string): { limit: number; site: string }
  • Performs some basic search validation

    Parameters

    • site: string

      The site to resolve

    • limit: number | string

      The limit for the amount of images to fetch

    Returns { limit: number; site: string }

    • limit: number
    • site: string

Generated using TypeDoc