Helper functions.
Classes
Methods
-
<static> decodeHtmlEntity(str)
-
Decode HTML entities in given string.
Parameters:
Name Type Description strString String that should be processed. Returns:
Decoded string.- Type
- String
-
<static> getHttpRequestError(err, response)
-
Return object that represents data about error of HTTP request.
Iferrparameter is set then it will be returned. Otherwise instance of FailedHttpRequestError will be returned.Parameters:
Name Type Description errError Represents data about error. responsehttp.IncomingMessage Represents data about response. Returns:
Error object.- Type
- Error
-
<static> getLimit( [settings] [, defaultValue] [, maxValue])
-
Return value of
limitsetting. Default value will be returned iflimitfield is not present insettingsparameter.Parameters:
Name Type Argument Description settingsObject <optional>
Operation settings. The object can have numeric limitfield which value will be returned if the value is positive number and not greater than maximum value. Otherwise value ofdefaultValueparameter will be returned.defaultValueNumber <optional>
Default value of limit. maxValueis used when parameter value is not passed or 0.maxValueNumber <optional>
Maximum value of limit. Number.MAX_VALUEis used when parameter value is not passed.Returns:
Value that corresponds tolimitsetting.- Type
- Number
-
<static> getRequestSettings( [settings] [, json])
-
Return request settings.
Parameters:
Name Type Argument Default Description settingsObject <optional>
Operation settings. The following settings are used to form request settings (name - type - description): requestTimeout-Integer- Number of milliseconds to wait for a response before aborting a data request
jsonBoolean <optional>
true Whether the setting to process response as JSON should be added. Returns:
Request settings.- Type
- Object
-
<static> isRealSearchSet( [settings])
-
Determine whether search should be made instead of check according to operation settings.
Parameters:
Name Type Argument Description settingsObject <optional>
Operation settings. The following settings are used to specify real search (name - type - description): search-Boolean- Whether search should be made instead of check
Returns:
trueif real search should be made according to settings,falseotherwise.- Type
- Boolean
-
<static> isSearchSet( [settings])
-
Check whether search should be made according to operation settings.
Parameters:
Name Type Argument Description settingsObject <optional>
Operation settings. The following settings are used to specify search (name - type - description): caseSensitive-Boolean- Whether case-sensitive check/search should be usedpartialMatch-Integer- Allow partial matching: 0 - disallow (by default), 1 - allow at the beginning of matching strings, 2 - allow substring matchingsearch-Boolean- Whether search should be made instead of check
Returns:
trueif search should be made according to settings,falseotherwise.- Type
- Boolean
-
<static> isStringMatch(value, searchValue [, settings])
-
Check whether one of given strings is similar to the searched string.
Parameters:
Name Type Argument Description valueArray | String String or array of strings that should be checked. searchValueString Value that is searched for. settingsObject <optional>
Operation settings. The following settings are supported (name - type - description): caseSensitive-Boolean- Whether case-sensitive check should be usedpartialMatch-Integer- Allow partial matching: 0 - disallow (by default), 1 - allow at the beginning of matching strings, 2 - allow substring matchingsearch-Boolean- Whether search should be made instead of check
Returns:
trueif one of given strings is similar to the searched string according to settings,falseotherwise.- Type
- Boolean