Module: util

util

Helper functions.
Source:

Methods

<static> getLimit(settings, defaultValue, maxValue) → {Number}

Return value of limit setting. Default value will be returned if limit field is not present in settings parameter.
Parameters:
Name Type Argument Description
settings Object <optional>
Operation settings. The object can have numeric limit field which value will be returned. Otherwise value of defaultValue parameter will be returned.
defaultValue Number <optional>
Default value of limit. maxValue is used when parameter value is not passed.
maxValue Number <optional>
Maximum value of limit. Number.MAX_VALUE is used when parameter value is not passed.
Source:
Returns:
Value that corresponds to limit setting.
Type
Number

<static> isSearchSet(settings) → {Boolean}

Check whether search should be made according to operation settings.
Parameters:
Name Type Argument Description
settings Object <optional>
Operation settings. The following settings are used to specify search (name - type - description):
  • caseSensitive - Boolean - Whether case-sensitive check should be used
  • partialMatch - Integer - Allow partial matching: 0 - disallow (by default), 1 - allow at the beginning of matching strings, 2 - allow substring matching
Source:
Returns:
true if search should be made according to settings, false otherwise.
Type
Boolean

<static> isStringMatch(value, searchValue, settings) → {Boolean}

Check whether the given string is similar to the searched string.
Parameters:
Name Type Argument Description
value String String that should be checked.
searchValue String Value that was searched for.
settings Object <optional>
Operation settings. The following settings are supported (name - type - description):
  • caseSensitive - Boolean - Whether case-sensitive check should be used
  • partialMatch - Integer - Allow partial matching: 0 - disallow (by default), 1 - allow at the beginning of matching strings, 2 - allow substring matching
Source:
Returns:
true if the given string is similar to the searched string according to settings, false otherwise.
Type
Boolean