api/utils/common

Module for some common utility functions and references

Description:
  • Module for some common utility functions and references

Source:

Classes

DataTable

Members

(inner, constant) common

Source:

(inner, constant) moment

Source:

Methods

(inner) escape_html_entities(key, value, more) → {any}

Description:
  • Escape special characters in the given value, may be nested object

Source:
Parameters:
Name Type Description
key string

key of the value

value any

value to escape

more boolean

if false, escapes only tags, if true escapes also quotes and ampersands

Returns:

escaped value

Type
any

(inner) getJSON(val) → {object}

Description:
  • Check if string is a valid json

Source:
Parameters:
Name Type Description
val string

string that might be json encoded

Returns:

with property data for parsed data and property valid to check if it was valid json encoded string or not

Type
object

(inner) recordMetric(params, metric, props, tmpSet, updateUsersZero, updateUsersMonth)

Description:
  • Record specific metric

Source:
Parameters:
Name Type Description
params Params

params object

metric string

metric to record

props object

properties of a metric defining how to record it

tmpSet object

object with already set meta properties

updateUsersZero object

object with already set update for zero docs

updateUsersMonth object

object with already set update for months docs

(inner) recordSegmentMetric(params, metric, name, val, props, tmpSet, updateUsersZero, updateUsersMonth, zeroObjUpdate, monthObjUpdate)

Description:
  • Record specific metric segment

Source:
Parameters:
Name Type Description
params Params

params object

metric string

metric to record

name string

name of the segment to record

val string

value of the segment to record

props object

properties of a metric defining how to record it

tmpSet object

object with already set meta properties

updateUsersZero object

object with already set update for zero docs

updateUsersMonth object

object with already set update for months docs

zeroObjUpdate Array.<string>

segments to fill for for zero docs

monthObjUpdate Array.<string>

segments to fill for months docs

(inner) stripPort(ip) → {string}

Description:
  • This function takes ipv4 or ipv6 with possible port, removes port information and returns plain ip address

Source:
Parameters:
Name Type Description
ip string

ip address to check for port and return plain ip

Returns:

plain ip address

Type
string