# Class: Utils

## Phaser. Utils

#### new Utils()

  Source:
    - utils/Utils.js, line 5

### Classes

Debug

### Methods

#### <static> extend(deep, target) → {object}

  This is a slightly modified version of http://api.jquery.com/jQuery.extend/

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `deep` | boolean | Perform a deep copy?
  `target` | object | The target object to copy to.

  Source:
    - utils/Utils.js, line 221

  ##### Returns:

  The extended object.

  Type
    object

#### <static> isPlainObject(obj) → {boolean}

  This is a slightly modified version of jQuery.isPlainObject. A plain object is an object whose internal class property is [object Object].

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `obj` | object | The object to inspect.

  Source:
    - utils/Utils.js, line 186

  ##### Returns:

  - true if the object is plain, otherwise false.
  Type
    boolean

#### <static> pad(str, len, pad, dir) → {string}

  Javascript string pad http://www.webtoolkit.info/. pad = the string to pad it out with (defaults to a space) dir = 1 (left), 2 (right), 3 (both)

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `str` | string |  |  | The target string.
  `len` | number |  |  | The number of characters to be added.
  `pad` | number |  |  | The string to pad it out with (defaults to a space).
  `dir` | number | <optional> | 3 | The direction dir = 1 (left), 2 (right), 3 (both).

  Source:
    - utils/Utils.js, line 143

  ##### Returns:

  The padded string

  Type
    string

#### <static> parseDimension(size, dimension) → {number}

  Get a unit dimension from a string.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `size` | string | number | The size to parse.
  `dimension` | number | The window dimension to check.

  Source:
    - utils/Utils.js, line 80

  ##### Returns:

  The parsed dimension.

  Type
    number

#### <static> rotateArray(matrix, direction) → {array}

  Rotates the given array. Based on the routine from http://jsfiddle.net/MrPolywhirl/NH42z/

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `matrix` | array | The array to rotate.
  `direction` | number | string | The amount to rotate. Either a number: 90, -90, 270, -270, 180 or a string: 'rotateLeft', 'rotateRight' or 'rotate180'

  Source:
    - utils/Utils.js, line 40

  ##### Returns:

  The rotated array

  Type
    array

#### <static> shuffle(array) → {array}

  A standard Fisher-Yates Array shuffle implementation.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `array` | array | The array to shuffle.

  Source:
    - utils/Utils.js, line 123

  ##### Returns:

  The shuffled array.

  Type
    array