Infohub JS API
Loading...
Searching...
No Matches
Func Class Reference

Description

Static helper functions.

Static Public Member Functions

static atou (b64)
static calcEdges (geo)
static clone (obj)
static compare (obj1, obj2, recursively=false)
static compileFilterString (projectlist, cataloguelist, constraints, property_typeids, ptr_property)
static componentToHex (c)
static count (obj)
static createId ()
static createTimestamp ()
static dbToTxt (str)
static elideText (str, max_length)
static getSizeAsString (size)
static getTokenList (str, start, end)
static htmlToText (html, all)
static increaseIndex (str_number)
static isEqual (val1, val2, propertytype, options=null)
static isValue (v)
static matchValue (value, propertytype, matchvalue, propertymap=null)
static md5 (inputString)
static replaceSpecialCharsWithASCII (id)
static replaceStr (str, olds, news)
static rgbToHex (r, g, b)
static sanitize (id)
static sanitizeText (str)
static sanitizeTooltip (a)
static txtToDb (str)
static utoa (data)
static validateArray (pattern)
static validateEmail (str)
static validateRegex (pattern)
static wildcardToRegex (wildcard)
static xor (a, b)

Function Documentation

◆ atou()

atou ( b64)
static
Parameters
{*}b64
Returns
{string}

◆ calcEdges()

calcEdges ( geo)
static
Parameters
{*}geo
Returns
{any}
Since
02.2026, SW

◆ clone()

clone ( obj)
static

Clone/Deep copy this object.

Parameters
{Object}obj
Returns
{Object}

◆ compare()

compare ( obj1,
obj2,
recursively = false )
static

Compares content of two objects (yet not recursively for objects!).

Parameters
{Object}obj1
{Object}obj2
{boolean}[recursively] not implemented yet
Returns
{boolean}

◆ compileFilterString()

compileFilterString ( projectlist,
cataloguelist,
constraints,
property_typeids,
ptr_property )
static

Compile filter string from id, type, name pattern and properties.

Parameters
{*}projectlist can be empty
{*}cataloguelist can be empty
{*}constraints = { 'pattern_object_id' : ' ... ' // AND 'pattern_object_name' : ' ... ' // AND 'pattern_object_type' : ' ... ' // AND }
{*}property_typeids Search in these property types
{*}ptr_property Search in each property type for this pattern
Returns
Filterstring according to web service

◆ componentToHex()

componentToHex ( c)
static

Convert component (R,G or B) to hex value.

0 => 0 255 => FF

Parameters
{number}c
Returns
{string}

◆ count()

count ( obj)
static

Count objects/keys in a dictionary.

Parameters
{Object}obj
Returns
{number} Number of 'own' properties

◆ createId()

createId ( )
static

Create a new ID.

Returns
{string} New ID

◆ createTimestamp()

createTimestamp ( )
static
Returns
{string}

◆ dbToTxt()

dbToTxt ( str)
static

Encode text from text to HTML acceptable text.


->
``` -> '

Parameters
{string}str
Returns
{string} */ static txtToHtml (str) {}

/**

Parameters
{string}str - Text to be decoded from DB format to JSON.
Returns
{string}

◆ elideText()

elideText ( str,
max_length )
static

Elide text.

Parameters
{string}str - Text
{number}max_length - Maximum length of text
Returns
{string|null} Center elided text or null if str = null

◆ getSizeAsString()

getSizeAsString ( size)
static

Get number of bytes as formatted text in suitable units ['Bytes', 'kB', 'MB', 'GB'].

Parameters
{number}size
Returns
{string}

◆ getTokenList()

getTokenList ( str,
start,
end )
static

Get tokens specified by start-end string in str Examples start = '[[' , end = ']]'.

Parameters
{string}str
{string}start
{string}end
Returns
{Array<string>} Array with extracted tokens, empty array if no tokens could be extractred

◆ htmlToText()

htmlToText ( html,
all )
static

Convert hmtl to plain text.

Parameters
{string}html
{boolean}all if true, get full text content (faster), else if slow get inner text (considering styles like display: none, slightly slower)
Returns
{string} Plain text, empty string if html is invalid

◆ increaseIndex()

increaseIndex ( str_number)
static

Increase Index given as A0, A1, ... , B0, B1, ...

Parameters
{*}str_number
Returns
{string}

◆ isEqual()

isEqual ( val1,
val2,
propertytype,
options = null )
static
Parameters
{*}val1
{*}val2
{Object}propertytype
{Object}options { precision: 0.0001, case_sensitive: true }
Returns
{boolean}

◆ isValue()

isValue ( v)
static
Parameters
{*}v
Returns
{boolean}

◆ matchValue()

matchValue ( value,
propertytype,
matchvalue,
propertymap = null )
static

Check if a property value matches the given values.

Parameters
{any}value Value of property. If null or undefined, false will be returned.
{string}xsdatatype Explicit data type of value ('xs:...')
{*}matchvalue Values : '*', ["A","B", "C"], [1,2,3], /^abc/g, == 'Text', > 1.234
{Object}propertymap Evaluated values for property references [[name##type]] { 'Text##xs:string' : "ABC", 'Number##xs:double' : 1.234 }
Returns
{boolean} true if match was successful, else false

◆ md5()

md5 ( inputString)
static

Create a md5 key from a given string.

Parameters
{string}inputString
Returns
{string} MD5 key

◆ replaceSpecialCharsWithASCII()

replaceSpecialCharsWithASCII ( id)
static

replaces each character of !

"#$%&'()*+,./:;<=>?[]^<tt>{|}~ with _\<ASCIcode\>_. So jQuery can work with it. see jquery docs: https://api.jquery.com/category/selectors/ Escaping with \\\\ as recommended there didn't work. \@param {String} id any String used as id with jquery \@returns {String} id but each character of !\"#$%&'()*+,./:;<=>?@[\]^{|}~ replaced by _<ASCIcode>_

◆ replaceStr()

replaceStr ( str,
olds,
news )
static
Parameters
{*}str
{*}olds
{*}news
Returns
{string}

◆ rgbToHex()

rgbToHex ( r,
g,
b )
static

Convert (RGB) color to hex value.

(0,0,0) => #000000 (255,255,255) => #FFFFFF

Parameters
{*}r
{*}g
{*}b
Returns
{string} @updated 02.2026, SW - this. istead of cn_func.

◆ sanitize()

sanitize ( id)
static

Sanitize ID.

Remove :, =, ' '

Parameters
{string}id
Returns
{string}

◆ sanitizeText()

sanitizeText ( str)
static

Remove 'invalid'/invisible characters from string which can occur when copy-pasting from html pages Todo: better Black- or Whitelist?

Ranges?

Parameters
{string}str
Returns
{string} Sanitized string

◆ sanitizeTooltip()

sanitizeTooltip ( a)
static

Convert a string which is stored in a db to a string that can be rendered in html.

``` -> '

Parameters
{*}str
Returns
{string} */ static dbToHtml (str) {}

/**

Sanitize string 'a' so it can be used in a html tooltip (title).

Parameters
{string}a
Returns
{string}

◆ txtToDb()

txtToDb ( str)
static

Encode text from text to JSON acceptable text.

So this text can be transferred and stored in a DB.


->
' -> ```

Parameters
{string}str - Text to be encoded from JSON
Returns
{string}

◆ utoa()

utoa ( data)
static
Parameters
{*}data
Returns
{string}

◆ validateArray()

validateArray ( pattern)
static

Check if pattern is a string representation (JSON) of an array.

Parameters
{string}pattern
Returns
{boolean}

◆ validateEmail()

validateEmail ( str)
static

Validates whether a text is a syntactically correct email address.

Note: The only way to reliably verify that a supplied email is a working valid email is to send a mail with a verification link

Parameters
{string}str - String holding the Email address
Returns
{boolean} True, if validation is successful, else false

◆ validateRegex()

validateRegex ( pattern)
static

Check if pattern is a valid regex expression.

Parameters
{string}pattern
Returns
{boolean}

◆ wildcardToRegex()

wildcardToRegex ( wildcard)
static
Parameters
{string}wildcard
Returns
{RegExp}

◆ xor()

xor ( a,
b )
static
Parameters
{*}a
{*}b
Returns
{boolean}