• Public
  • Public/Protected
  • All

External module "utils/utils"



Const randomBytes

randomBytes: function = promisify(cryptoRandomBytes)

A promisified wrapper for the NodeJS crypto.randomBytes method.

Type declaration

    • (arg1: T1): Promise<TResult>
    • Parameters

      • arg1: T1

      Returns Promise<TResult>

Const setTimeoutPromise

setTimeoutPromise: __promisify__ = promisify(setTimeout)

A promisified wrapper for the NodeJS setTimeout method.


Const base64ToHex

  • base64ToHex(b64: string): string

Const convertKvpArrayToKvps

  • convertKvpArrayToKvps<T>(kvpArray: [string, T][]): object
  • Converts an array of key value pair arrays into an object with the key value pairs.

    Type parameters

    • T


    • kvpArray: [string, T][]

    Returns object

    • [key: string]: T

Const deepMerge

  • deepMerge(target: any, ...sources: any[]): object
  • Recursively merge properties from different sources into a target object, overriding any existing properties.


    • target: any

      the destination object to merge into.

    • Rest ...sources: any[]

      the sources objects to copy from.

    Returns object

Const derivePairId

  • derivePairId(pair: Pair): string
  • Convert a pair's base currency and quote currency to a ticker symbol pair id.


    Returns string

Const generatePreimageAndHash

  • generatePreimageAndHash(): Promise<object>
  • Returns a random payment preimage and hash in hex encoding.

    Returns Promise<object>

Const getExternalIp

  • getExternalIp(): Promise<string>
  • Gets the external IP of the node.

    Returns Promise<string>

Const getPublicMethods

  • getPublicMethods(obj: any): any
  • Get all methods from an object whose name doesn't start with an underscore.


    • obj: any

    Returns any

Const getTsString

  • getTsString(dateFormat?: undefined | string): string
  • Get the current date in the given dateFormat, if not provided formats with YYYY-MM-DD hh:mm:ss.sss.


    • Optional dateFormat: undefined | string

    Returns string

Const groupBy

  • groupBy(arr: object[], keyGetter: function): any
  • Parameters

    • arr: object[]
    • keyGetter: function
        • (item: any): string | number
        • Parameters

          • item: any

          Returns string | number

    Returns any

Const hexToUint8Array

  • hexToUint8Array(hex: string): Uint8Array

Const isEmptyObject

  • isEmptyObject(val: any): boolean
  • Check whether a variable is an empty object


    • val: any

    Returns boolean

Const isObject

  • isObject(val: any): boolean
  • Check whether a variable is a non-array object


    • val: any

    Returns boolean

Const isPlainObject

  • isPlainObject(obj: any): boolean
  • A simplified copy of lodash's isPlainObject;

    A plain object is;

    • prototype should be [object Object]
    • shouldn't be null
    • its type should be 'object' (does extra check because typeof null == object)

    Examples; isPlainObject(new Foo); => false isPlainObject([1, 2, 3]); => false isPlainObject({ 'x': 0, 'y': 0 }); => true isPlainObject(Object.create(null)); => true


    • obj: any

    Returns boolean

Const ms

  • ms(): number
  • Get current time in unix time (milliseconds).

    Returns number

Const removeUndefinedProps

  • removeUndefinedProps<T>(typedObj: T): T

Const setObjectToMap

  • setObjectToMap(obj: any, map: object): void
  • Parameters

    • obj: any
    • map: object
      • set: function
          • (key: string, value: any): any
          • Parameters

            • key: string
            • value: any

            Returns any

    Returns void

Const sortOrders

  • sortOrders(orders: Order[], isBuy: boolean): Order[]

Generated using TypeDoc