> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pba-ctools/pentaho-cdf-api/dashboard/utils.md).

# Utils

## cdf.dashboard. Utils

Static

A collection of utility functions.

**AMD Module**

```
require(["cdf/dashboard/Utils"], function(Utils) { /* code goes here */ });
```

\*\*Source:\*\*dashboard/Utils.js, line 24

## Methods

| Name                                                                             | Description                                                           |
| -------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| Utils.addArgs(url)Deprecated                                                     | Adds the URL parameters to a local object.                            |
| Utils.clone(obj) : `object`Deprecated                                            | Deep clones an object.                                                |
| Utils.configLanguage(langCode, config)                                           | Configure a language.                                                 |
| Utils.dateFormat(date, mask, langCode) : `string`                                | Formats a date.                                                       |
| Utils.dateParse(date, mask) : `Date`                                             | Parses a date with a given mask.                                      |
| Utils.doCsvQuoting(value, separator, alwaysEscape) : `string`                    | Quote CSV values in a way that is compatible with CSVTokenizer.       |
| Utils.eachValuesArray(values, opts, f, x) : `boolean`                            | Traverses each *value*, *label*, and *id* triple of a *values array*. |
| Utils.equalValues(a, b) : `boolean`                                              | Determines if two values are considered equal.                        |
| Utils.escapeHtml(input) : `string`                                               | Escapes a string as an HTML safe string.                              |
| Utils.ev(o) : `object`                                                           | Evaluates the argument.                                               |
| Utils.getArgValue(key) : `object` \| `undefined`Deprecated                       | Gets an argument value that was previously set by calling `addArgs`.  |
| Utils.getLocationSearchString() : `string`                                       | Returns the query string part of the URL.                             |
| Utils.getPathParameter(url) : `string` \| `undefined`                            | Gets the path from the URL.                                           |
| Utils.getQueryParameter(parameterName) : `string`                                | Returns the value of a query string parameter.                        |
| Utils.getURLParameters(sURL) : `Array.<`Array.<`String`>`>`                      | Gets the parameters from a URL.                                       |
| Utils.hsvToRgb(h, s, v) : `string`                                               | Converts an HSV to an RGB color value.                                |
| Utils.isArray(value) : `boolean`                                                 | Determines if a value is considered an array.                         |
| Utils.isFunction(value) : `boolean`                                              | Determines if a value is considered a function.                       |
| Utils.isNumber(value) : `boolean`                                                | Determines if a value is considered a number.                         |
| Utils.isString(value) : `boolean`                                                | Determines if a value is considered a string.                         |
| Utils.normalizeValue(value) : `object`                                           | Normalizes a value.                                                   |
| Utils.numberFormat(value, mask, langCode) : `string`                             | Formats a number.                                                     |
| Utils.objectToPropertiesArray(obj) : `Array.<`Array.<`Object`>`>` \| `undefined` | Converts an object to an array.                                       |
| Utils.parseMultipleValues(value) : `array` \| `object`                           | Given a parameter value obtains an equivalent values array.           |
| Utils.post(url, obj)                                                             | Performs a post to the server.                                        |
| Utils.propertiesArrayToObject(pArray) : `object` \| `undefined`                  | Converts an array to an object.                                       |
| Utils.sanitizeHtml(html) : `string`                                              | Sanitizes input HTML.                                                 |

## Methods Details

| **Utils.addArgs**(url)Deprecated                                                                                      |               |                                               |
| --------------------------------------------------------------------------------------------------------------------- | ------------- | --------------------------------------------- |
| <p>Adds the URL parameters to a local <code>args</code> object.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 469</p> |               |                                               |
| Name                                                                                                                  | Default Value | Summary                                       |
| url : `string`                                                                                                        |               | The URL from which to extract the parameters. |

| Name           | Default Value | Summary                                       |
| -------------- | ------------- | --------------------------------------------- |
| url : `string` |               | The URL from which to extract the parameters. |

| **Utils.clone**(obj) : `object`Deprecated                                                                                     |                    |                      |
| ----------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------------------- |
| <p>Deep clones an object. This method is deprecated, use jQuery.extend.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 431</p> |                    |                      |
| Name                                                                                                                          | Default Value      | Summary              |
| obj : `object`                                                                                                                |                    | The object to clone. |
| Name                                                                                                                          | Description        |                      |
| `object`                                                                                                                      | The cloned object. |                      |

| Name     | Description        |
| -------- | ------------------ |
| `object` | The cloned object. |

| Name           | Default Value | Summary              |
| -------------- | ------------- | -------------------- |
| obj : `object` |               | The object to clone. |

| **Utils.configLanguage**(langCode, config)                                                                                                                |               |                                         |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | --------------------------------------- |
| <p>Configure a new or existing language by specifying the language code and a configuration object.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 179</p> |               |                                         |
| Name                                                                                                                                                      | Default Value | Summary                                 |
| langCode : `string`                                                                                                                                       |               | Language code to be used.               |
| config : `object`                                                                                                                                         |               | Object with the language configuration. |
| Name                                                                                                                                                      | Default Value | Summary                                 |
| number : `object`                                                                                                                                         |               | Number format language configuration.   |
| dateLocale : `object`                                                                                                                                     |               | Date format language configuration.     |

| Name                  | Default Value | Summary                               |
| --------------------- | ------------- | ------------------------------------- |
| number : `object`     |               | Number format language configuration. |
| dateLocale : `object` |               | Date format language configuration.   |

| Name                  | Default Value | Summary                                 |
| --------------------- | ------------- | --------------------------------------- |
| langCode : `string`   |               | Language code to be used.               |
| config : `object`     |               | Object with the language configuration. |
| Name                  | Default Value | Summary                                 |
| number : `object`     |               | Number format language configuration.   |
| dateLocale : `object` |               | Date format language configuration.     |

| Name                  | Default Value | Summary                               |
| --------------------- | ------------- | ------------------------------------- |
| number : `object`     |               | Number format language configuration. |
| dateLocale : `object` |               | Date format language configuration.   |

| **Utils.dateFormat**(date, mask, langCode) : `string`                                                                                                                                                  |                     |                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- | ------------------------------ |
| <p>Formats a date with a given mask using the dashboard language, the one that the user specified if it exists, or the default language 'en-US'.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 201</p> |                     |                                |
| Name                                                                                                                                                                                                   | Default Value       | Summary                        |
| date : `Date`                                                                                                                                                                                          |                     | Date object to be formatted.   |
| mask : `string`                                                                                                                                                                                        |                     | Mask with format for the date. |
| langCode : `string`                                                                                                                                                                                    |                     | Language to use in format.     |
| Name                                                                                                                                                                                                   | Description         |                                |
| `string`                                                                                                                                                                                               | The formatted date. |                                |

| Name     | Description         |
| -------- | ------------------- |
| `string` | The formatted date. |

| Name                | Default Value | Summary                        |
| ------------------- | ------------- | ------------------------------ |
| date : `Date`       |               | Date object to be formatted.   |
| mask : `string`     |               | Mask with format for the date. |
| langCode : `string` |               | Language to use in format.     |

| **Utils.dateParse**(date, mask) : `Date`                                                  |                                   |                                        |
| ----------------------------------------------------------------------------------------- | --------------------------------- | -------------------------------------- |
| <p>Parses a date with a given mask.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 229</p> |                                   |                                        |
| Name                                                                                      | Default Value                     | Summary                                |
| date : `string`                                                                           |                                   | The date to be parsed.                 |
| mask : `string`                                                                           |                                   | The mask with the format for the date. |
| Name                                                                                      | Description                       |                                        |
| `Date`                                                                                    | The parsed date as a Date object. |                                        |

| Name   | Description                       |
| ------ | --------------------------------- |
| `Date` | The parsed date as a Date object. |

| Name            | Default Value | Summary                                |
| --------------- | ------------- | -------------------------------------- |
| date : `string` |               | The date to be parsed.                 |
| mask : `string` |               | The mask with the format for the date. |

| **Utils.doCsvQuoting**(value, separator, alwaysEscape) : `string`                                                        |                              |                                                                                |
| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | ------------------------------------------------------------------------------ |
| <p>Quote CSV values in a way that is compatible with CSVTokenizer.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 363</p> |                              |                                                                                |
| Name                                                                                                                     | Default Value                | Summary                                                                        |
| value : `string`                                                                                                         |                              | Value quote.                                                                   |
| separator : `string`                                                                                                     |                              | Separator to use when quoting.                                                 |
| alwaysEscape : `boolean`                                                                                                 |                              | Flag that indicates if the value should always be escaped or just when needed. |
| Name                                                                                                                     | Description                  |                                                                                |
| `string` \| `null`                                                                                                       | The escaped value or `null`. |                                                                                |

| Name               | Description                  |
| ------------------ | ---------------------------- |
| `string` \| `null` | The escaped value or `null`. |

| Name                     | Default Value | Summary                                                                        |
| ------------------------ | ------------- | ------------------------------------------------------------------------------ |
| value : `string`         |               | Value quote.                                                                   |
| separator : `string`     |               | Separator to use when quoting.                                                 |
| alwaysEscape : `boolean` |               | Flag that indicates if the value should always be escaped or just when needed. |

| **Utils.eachValuesArray**(values, opts, f, x) : `boolean`                                                                                                    |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |   |      |             |   |           |                                                                                                |      |   |   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | ---- | ----------- | - | --------- | ---------------------------------------------------------------------------------------------- | ---- | - | - |
| <p>Traverses each <em>value</em>, <em>label</em> and <em>id</em> triple of a <em>values array</em>.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 535</p><p> | Name          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |   | ---- | ----------- |   | `boolean` | `true` if the traversal was complete, `false` if explicitly stopped by the traversal function. | </p> |   |   |
| Name                                                                                                                                                         | Default Value | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |   |      |             |   |           |                                                                                                |      |   |   |
| values : `Array.<`Array.<`string`>`>`                                                                                                                        |               | <p>The values array - an array of arrays.</p><p>Each second-level array is a <em>value specification</em> and contains a value and, optionally, a label and an id. It may have the following forms:</p><ul><li><code>\[valueAndLabel]</code>: when having <em>length</em> one</li><li><code>\[value, label,...]</code>: when having <em>length</em> two or more and <code>opts.valueAsId</code> is falsy</li><li><code>\[id, valueAndLabel,..]</code>: when having <em>length</em> two or more and <code>opts.valueAsId</code> is truthy</li></ul> |   |      |             |   |           |                                                                                                |      |   |   |
| opts : `object`                                                                                                                                              |               | An object with options.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |   |      |             |   |           |                                                                                                |      |   |   |
| Name                                                                                                                                                         | Default Value | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |   |      |             |   |           |                                                                                                |      |   |   |
| valueAsId : `boolean`Optional                                                                                                                                | false         | Indicates if the first element of the value specification array is the id, instead of the value.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |   |      |             |   |           |                                                                                                |      |   |   |
| f : `function`                                                                                                                                               |               | <p>The traversal function that is to be called with each value-label-id triple and with the JS context <code>x</code>. The function is called with arguments: <code>value</code>, <code>label</code>, <code>id</code>, and <code>index</code>.</p><p>When the function returns the value <code>false</code>, traversal is stopped, and <code>false</code> is returned.</p>                                                                                                                                                                         |   |      |             |   |           |                                                                                                |      |   |   |
| x : `object`                                                                                                                                                 |               | The JS context object on which `f` is to be called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |   |      |             |   |           |                                                                                                |      |   |   |

| Name                          | Default Value | Summary                                                                                          |
| ----------------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
| valueAsId : `boolean`Optional | false         | Indicates if the first element of the value specification array is the id, instead of the value. |

| Name                                  | Default Value | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| values : `Array.<`Array.<`string`>`>` |               | <p>The values array - an array of arrays.</p><p>Each second-level array is a <em>value specification</em> and contains a value and, optionally, a label and an id. It may have the following forms:</p><ul><li><code>\[valueAndLabel]</code>: when having <em>length</em> one</li><li><code>\[value, label,...]</code>: when having <em>length</em> two or more and <code>opts.valueAsId</code> is falsy</li><li><code>\[id, valueAndLabel,..]</code>: when having <em>length</em> two or more and <code>opts.valueAsId</code> is truthy</li></ul> |
| opts : `object`                       |               | An object with options.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Name                                  | Default Value | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| valueAsId : `boolean`Optional         | false         | Indicates if the first element of the value specification array is the id, instead of the value.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| f : `function`                        |               | <p>The traversal function that is to be called with each value-label-id triple and with the JS context <code>x</code>. The function is called with arguments: <code>value</code>, <code>label</code>, <code>id</code>, and <code>index</code>.</p><p>When the function returns the value <code>false</code>, traversal is stopped, and <code>false</code> is returned.</p>                                                                                                                                                                         |
| x : `object`                          |               | The JS context object on which `f` is to be called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

| Name                          | Default Value | Summary                                                                                          |
| ----------------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
| valueAsId : `boolean`Optional | false         | Indicates if the first element of the value specification array is the id, instead of the value. |

| **Utils.equalValues**(a, b) : `boolean`                                                                 |                                     |                   |
| ------------------------------------------------------------------------------------------------------- | ----------------------------------- | ----------------- |
| <p>Determines if two values are considered equal.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 677</p> |                                     |                   |
| Name                                                                                                    | Default Value                       | Summary           |
| a : `object`                                                                                            |                                     | The first value.  |
| b : `object`                                                                                            |                                     | The second value. |
| Name                                                                                                    | Description                         |                   |
| `boolean`                                                                                               | `true` if equal, `false` otherwise. |                   |

| Name      | Description                         |
| --------- | ----------------------------------- |
| `boolean` | `true` if equal, `false` otherwise. |

| Name         | Default Value | Summary           |
| ------------ | ------------- | ----------------- |
| a : `object` |               | The first value.  |
| b : `object` |               | The second value. |

| **Utils.escapeHtml**(input) : `string`                                                                                                                                                       |                                                                                    |                           |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------- |
| <p>Escapes a string as an HTML safe string. It assumes that, if there is an escaped char in the input, then the input is fully escaped.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 62</p> |                                                                                    |                           |
| Name                                                                                                                                                                                         | Default Value                                                                      | Summary                   |
| input : `string`                                                                                                                                                                             |                                                                                    | The string to be escaped. |
| Name                                                                                                                                                                                         | Description                                                                        |                           |
| `string`                                                                                                                                                                                     | The escaped string or an empty string if it receives anything other than a string. |                           |

| Name     | Description                                                                        |
| -------- | ---------------------------------------------------------------------------------- |
| `string` | The escaped string or an empty string if it receives anything other than a string. |

| Name             | Default Value | Summary                   |
| ---------------- | ------------- | ------------------------- |
| input : `string` |               | The string to be escaped. |

| **Utils.ev**(o) : `object`                                                                                                                                |                                                                                 |                                               |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------- |
| <p>Evaluates the argument. If it is a function, calls the function, otherwise returns the argument.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 391</p> |                                                                                 |                                               |
| Name                                                                                                                                                      | Default Value                                                                   | Summary                                       |
| o : `object`                                                                                                                                              |                                                                                 | The object to try and evaluate as a function. |
| Name                                                                                                                                                      | Description                                                                     |                                               |
| `object`                                                                                                                                                  | The value of `o` if it isn't a function. Otherwise, the result of invoking `o`. |                                               |

| Name     | Description                                                                     |
| -------- | ------------------------------------------------------------------------------- |
| `object` | The value of `o` if it isn't a function. Otherwise, the result of invoking `o`. |

| Name         | Default Value | Summary                                       |
| ------------ | ------------- | --------------------------------------------- |
| o : `object` |               | The object to try and evaluate as a function. |

| **Utils.getArgValue**(key) : `object` \| `undefined`Deprecated                                                                                                                                                                               |                                    |                    |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ------------------ |
| <p>Gets an argument value that was previously set by calling <code>addArgs</code>. This is deprecated, so use <code>getQueryParameter</code> or <code>dashboard.context.params</code>.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 489</p> |                                    |                    |
| Name                                                                                                                                                                                                                                         | Default Value                      | Summary            |
| key : `string`                                                                                                                                                                                                                               |                                    | The argument name. |
| Name                                                                                                                                                                                                                                         | Description                        |                    |
| `object` \| `undefined`                                                                                                                                                                                                                      | The argument value or `undefined`. |                    |

| Name                    | Description                        |
| ----------------------- | ---------------------------------- |
| `object` \| `undefined` | The argument value or `undefined`. |

| Name           | Default Value | Summary            |
| -------------- | ------------- | ------------------ |
| key : `string` |               | The argument name. |

| **Utils.getLocationSearchString**() : `string`                                                     |                   |
| -------------------------------------------------------------------------------------------------- | ----------------- |
| <p>Returns the query string part of the URL.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 121</p> |                   |
| Name                                                                                               | Description       |
| `string`                                                                                           | The query string. |

| Name     | Description       |
| -------- | ----------------- |
| `string` | The query string. |

| **Utils.getPathParameter**(url) : `string` \| `undefined`                                                                                                                   |                                                  |                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | ------------------ |
| <p>Given a URL containing an encoded Pentaho path, e.g. <code>:home:admin:Test.wcdf</code>, returns the encoded path.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 102</p> |                                                  |                    |
| Name                                                                                                                                                                        | Default Value                                    | Summary            |
| url : `string`                                                                                                                                                              |                                                  | The URL to encode. |
| Name                                                                                                                                                                        | Description                                      |                    |
| `string` \| `undefined`                                                                                                                                                     | The encoded URL or `undefined` if not available. |                    |

| Name                    | Description                                      |
| ----------------------- | ------------------------------------------------ |
| `string` \| `undefined` | The encoded URL or `undefined` if not available. |

| Name           | Default Value | Summary            |
| -------------- | ------------- | ------------------ |
| url : `string` |               | The URL to encode. |

| **Utils.getQueryParameter**(parameterName) : `string`                                                   |                                                      |                            |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | -------------------------- |
| <p>Returns the value of a query string parameter.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 133</p> |                                                      |                            |
| Name                                                                                                    | Default Value                                        | Summary                    |
| parameterName : `string`                                                                                |                                                      | The name of the parameter. |
| Name                                                                                                    | Description                                          |                            |
| `string`                                                                                                | The value of the query parameter or an empty string. |                            |

| Name     | Description                                          |
| -------- | ---------------------------------------------------- |
| `string` | The value of the query parameter or an empty string. |

| Name                     | Default Value | Summary                    |
| ------------------------ | ------------- | -------------------------- |
| parameterName : `string` |               | The name of the parameter. |

| **Utils.getURLParameters**(sURL) : `Array.<`Array.<`String`>`>`                                                                                                                                                                                                                                                                                               |                                                                                                                                                                |                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| <p>Gets the parameters from a URL. CDF URL parameters are defined as those that are present in the query string with names starting with the string <code>param</code>. So, for a query string like <code>?paramfoo=bar</code>, you would get a parameter <code>foo</code> with value <code>bar</code>.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 310</p> |                                                                                                                                                                |                                         |
| Name                                                                                                                                                                                                                                                                                                                                                          | Default Value                                                                                                                                                  | Summary                                 |
| sURL : `string`                                                                                                                                                                                                                                                                                                                                               |                                                                                                                                                                | URL with the query string to be parsed. |
| Name                                                                                                                                                                                                                                                                                                                                                          | Description                                                                                                                                                    |                                         |
| `Array.<`Array.<`String`>`>`                                                                                                                                                                                                                                                                                                                                  | Array with the parsed parameters. Each element is an array with two positions, the first being the parameter name and the second the value. For example, \`\`. |                                         |

| Name                         | Description                                                                                                                                                    |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Array.<`Array.<`String`>`>` | Array with the parsed parameters. Each element is an array with two positions, the first being the parameter name and the second the value. For example, \`\`. |

| Name            | Default Value | Summary                                 |
| --------------- | ------------- | --------------------------------------- |
| sURL : `string` |               | URL with the query string to be parsed. |

| **Utils.hsvToRgb**(h, s, v) : `string`                                                                                                                                          |                                         |                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------------------------------------ |
| <p>Converts an HSV to an RGB color value. Based on the algorithm described at <http://en.wikipedia.org/wiki/HSL_and_HSV>.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 706</p> |                                         |                                            |
| Name                                                                                                                                                                            | Default Value                           | Summary                                    |
| h : `number`                                                                                                                                                                    |                                         | Hue as a value between 0 - 360 (degrees).  |
| s : `number`                                                                                                                                                                    |                                         | Saturation as a value between 0 - 100 (%). |
| v : `number`                                                                                                                                                                    |                                         | Value as a value between 0 - 100 (%).      |
| Name                                                                                                                                                                            | Description                             |                                            |
| `string`                                                                                                                                                                        | A RGB color string (e.g. "rgb(1,2,3)"). |                                            |

| Name     | Description                             |
| -------- | --------------------------------------- |
| `string` | A RGB color string (e.g. "rgb(1,2,3)"). |

| Name         | Default Value | Summary                                    |
| ------------ | ------------- | ------------------------------------------ |
| h : `number` |               | Hue as a value between 0 - 360 (degrees).  |
| s : `number` |               | Saturation as a value between 0 - 100 (%). |
| v : `number` |               | Value as a value between 0 - 100 (%).      |

| **Utils.isArray**(value) : `boolean`                                                                                                                                                                                                                            |                                                                      |            |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | ---------- |
| <p>Determines if a value is considered an array.</p><p>Returns <code>true</code> if value is an array, or an array-like object (object containing the methods <code>join</code> and <code>length</code>).</p><p>\*\*Source:\*\*dashboard/Utils.js, line 619</p> |                                                                      |            |
| Name                                                                                                                                                                                                                                                            | Default Value                                                        | Summary    |
| value : `object`                                                                                                                                                                                                                                                |                                                                      | The value. |
| Name                                                                                                                                                                                                                                                            | Description                                                          |            |
| `boolean`                                                                                                                                                                                                                                                       | `true` if it is an array or an array-like object, `false` otherwise. |            |

| Name      | Description                                                          |
| --------- | -------------------------------------------------------------------- |
| `boolean` | `true` if it is an array or an array-like object, `false` otherwise. |

| Name             | Default Value | Summary    |
| ---------------- | ------------- | ---------- |
| value : `object` |               | The value. |

| **Utils.isFunction**(value) : `boolean`                                                                  |                                             |                         |
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------- | ----------------------- |
| <p>Determines if a value is considered a function.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 635</p> |                                             |                         |
| Name                                                                                                     | Default Value                               | Summary                 |
| value : `any`                                                                                            |                                             | The value to be tested. |
| Name                                                                                                     | Description                                 |                         |
| `boolean`                                                                                                | `true` if is a function; `false` otherwise. |                         |

| Name      | Description                                 |
| --------- | ------------------------------------------- |
| `boolean` | `true` if is a function; `false` otherwise. |

| Name          | Default Value | Summary                 |
| ------------- | ------------- | ----------------------- |
| value : `any` |               | The value to be tested. |

| **Utils.isNumber**(value) : `boolean`                                                                  |                                           |                         |
| ------------------------------------------------------------------------------------------------------ | ----------------------------------------- | ----------------------- |
| <p>Determines if a value is considered a number.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 663</p> |                                           |                         |
| Name                                                                                                   | Default Value                             | Summary                 |
| value : `any`                                                                                          |                                           | The value to be tested. |
| Name                                                                                                   | Description                               |                         |
| `boolean`                                                                                              | `true` if is a string; `false` otherwise. |                         |

| Name      | Description                               |
| --------- | ----------------------------------------- |
| `boolean` | `true` if is a string; `false` otherwise. |

| Name          | Default Value | Summary                 |
| ------------- | ------------- | ----------------------- |
| value : `any` |               | The value to be tested. |

| **Utils.isString**(value) : `boolean`                                                                  |                                           |                         |
| ------------------------------------------------------------------------------------------------------ | ----------------------------------------- | ----------------------- |
| <p>Determines if a value is considered a string.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 649</p> |                                           |                         |
| Name                                                                                                   | Default Value                             | Summary                 |
| value : `any`                                                                                          |                                           | The value to be tested. |
| Name                                                                                                   | Description                               |                         |
| `boolean`                                                                                              | `true` if is a string; `false` otherwise. |                         |

| Name      | Description                               |
| --------- | ----------------------------------------- |
| `boolean` | `true` if is a string; `false` otherwise. |

| Name          | Default Value | Summary                 |
| ------------- | ------------- | ----------------------- |
| value : `any` |               | The value to be tested. |

| **Utils.normalizeValue**(value) : `object`                                                                                                                                         |                                 |                         |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ----------------------- |
| <p>Normalizes a value so that <code>undefined</code>, empty string, and empty array are all translated to <code>null</code>.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 601</p> |                                 |                         |
| Name                                                                                                                                                                               | Default Value                   | Summary                 |
| value : `object`                                                                                                                                                                   |                                 | The value to normalize. |
| Name                                                                                                                                                                               | Description                     |                         |
| `object` \| `null`                                                                                                                                                                 | The normalized value or `null`. |                         |

| Name               | Description                     |
| ------------------ | ------------------------------- |
| `object` \| `null` | The normalized value or `null`. |

| Name             | Default Value | Summary                 |
| ---------------- | ------------- | ----------------------- |
| value : `object` |               | The value to normalize. |

| **Utils.numberFormat**(value, mask, langCode) : `string`                                                                                                                                                 |                       |                                 |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------- |
| <p>Formats a number with a given mask using the dashboard language, the one that the user specified if it exists, or the default language 'en-US'.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 153</p> |                       |                                 |
| Name                                                                                                                                                                                                     | Default Value         | Summary                         |
| value : `number`                                                                                                                                                                                         |                       | Number value to be formatted.   |
| mask : `string`                                                                                                                                                                                          |                       | Mask with format for the value. |
| langCode : `string`                                                                                                                                                                                      |                       | Language to use in format.      |
| Name                                                                                                                                                                                                     | Description           |                                 |
| `string`                                                                                                                                                                                                 | The formatted number. |                                 |

| Name     | Description           |
| -------- | --------------------- |
| `string` | The formatted number. |

| Name                | Default Value | Summary                         |
| ------------------- | ------------- | ------------------------------- |
| value : `number`    |               | Number value to be formatted.   |
| mask : `string`     |               | Mask with format for the value. |
| langCode : `string` |               | Language to use in format.      |

| **Utils.objectToPropertiesArray**(obj) : `Array.<`Array.<`Object`>`>` \| `undefined`     |                                                                                                   |                                           |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| <p>Converts an object to an array.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 293</p> |                                                                                                   |                                           |
| Name                                                                                     | Default Value                                                                                     | Summary                                   |
| obj : `object`                                                                           |                                                                                                   | The object to be converted into an array. |
| Name                                                                                     | Description                                                                                       |                                           |
| `Array.<`Array.<`Object`>`>` \| `undefined`                                              | An array of key-value pairs (array) or `undefined` if the argument is not an object, e. g., \`\`. |                                           |

| Name                                        | Description                                                                                       |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `Array.<`Array.<`Object`>`>` \| `undefined` | An array of key-value pairs (array) or `undefined` if the argument is not an object, e. g., \`\`. |

| Name           | Default Value | Summary                                   |
| -------------- | ------------- | ----------------------------------------- |
| obj : `object` |               | The object to be converted into an array. |

| **Utils.parseMultipleValues**(value) : `array` \| `object`                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                                                            |                                                        |   |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ | - |
| <p>Given a parameter value obtains an equivalent values array.</p><p>The parameter value may encode multiple values in a string format.</p><p>A nully (i.e. <code>null</code> or <code>undefined</code>) input value or an empty string results in <code>null</code>, so the result of this method is normalized.</p><p>A string value may contain multiple values separated by the character <code> | </code>.</p><p>An array or array-like object is returned without modification.</p><p>Any other value type returns <code>null</code>.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 581</p> |                                                        |   |
| Name                                                                                                                                                                                                                                                                                                                                                                                                 | Default Value                                                                                                                                                                              | Summary                                                |   |
| value : `object`                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                                                                                                            | A parameter value, as returned by `getParameterValue`. |   |
| Name                                                                                                                                                                                                                                                                                                                                                                                                 | Description                                                                                                                                                                                |                                                        |   |
| `array` \| `object`                                                                                                                                                                                                                                                                                                                                                                                  | An array, an array-like object, or `null`.                                                                                                                                                 |                                                        |   |

| Name                | Description                                |
| ------------------- | ------------------------------------------ |
| `array` \| `object` | An array, an array-like object, or `null`. |

| Name             | Default Value | Summary                                                |
| ---------------- | ------------- | ------------------------------------------------------ |
| value : `object` |               | A parameter value, as returned by `getParameterValue`. |

| **Utils.post**(url, obj)                                                                |               |                        |
| --------------------------------------------------------------------------------------- | ------------- | ---------------------- |
| <p>Performs a post to the server.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 403</p> |               |                        |
| Name                                                                                    | Default Value | Summary                |
| url : `string`                                                                          |               | The URL where to post. |
| obj : `object`                                                                          |               | Parameter object.      |

| Name           | Default Value | Summary                |
| -------------- | ------------- | ---------------------- |
| url : `string` |               | The URL where to post. |
| obj : `object` |               | Parameter object.      |

| **Utils.propertiesArrayToObject**(pArray) : `object` \| `undefined`                      |               |                                                                 |
| ---------------------------------------------------------------------------------------- | ------------- | --------------------------------------------------------------- |
| <p>Converts an array to an object.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 278</p> |               |                                                                 |
| Name                                                                                     | Default Value | Summary                                                         |
| pArray : `Array.<`Array.<`Object`>`>`                                                    |               | An array of key-value pairs (array) to be converted, e.g.,\`\`. |
| Name                                                                                     | Description   |                                                                 |
| `object` \| `undefined`                                                                  | /p            |                                                                 |

| Name                    | Description |
| ----------------------- | ----------- |
| `object` \| `undefined` | /p          |

| Name                                  | Default Value | Summary                                                         |
| ------------------------------------- | ------------- | --------------------------------------------------------------- |
| pArray : `Array.<`Array.<`Object`>`>` |               | An array of key-value pairs (array) to be converted, e.g.,\`\`. |

| **Utils.sanitizeHtml**(html) : `string`                                                                                                                           |                           |                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ------------------------- |
| <p>Uses <https://code.google.com/archive/p/google-caja/source>. Strips unsafe tags and attributes from html.</p><p>\*\*Source:\*\*dashboard/Utils.js, line 86</p> |                           |                           |
| Name                                                                                                                                                              | Default Value             | Summary                   |
| html : `string`                                                                                                                                                   |                           | The HTML to be sanitized. |
| Name                                                                                                                                                              | Description               |                           |
| `string`                                                                                                                                                          | safe HTML based on input. |                           |

| Name     | Description               |
| -------- | ------------------------- |
| `string` | safe HTML based on input. |

| Name            | Default Value | Summary                   |
| --------------- | ------------- | ------------------------- |
| html : `string` |               | The HTML to be sanitized. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pentaho.com/pba-ctools/pentaho-cdf-api/dashboard/utils.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
