Improved JSDocs

This commit is contained in:
Richard Davey 2020-09-15 10:37:19 +01:00
parent 99c12540f7
commit 08b4597b72
9 changed files with 125 additions and 12 deletions

View file

@ -7,22 +7,23 @@
/**
* Checks if an array can be used as a matrix.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows:
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.CheckMatrix
* @since 3.0.0
*
*
* @generic T
* @genericUse {T[][]} - [matrix]
*

View file

@ -10,6 +10,20 @@ var CheckMatrix = require('./CheckMatrix');
/**
* Generates a string (which you can pass to console.log) from the given Array Matrix.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.MatrixToString
* @since 3.0.0
*

View file

@ -7,6 +7,20 @@
/**
* Reverses the columns in the given Array Matrix.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.ReverseColumns
* @since 3.0.0
*

View file

@ -7,6 +7,20 @@
/**
* Reverses the rows in the given Array Matrix.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.ReverseRows
* @since 3.0.0
*

View file

@ -9,6 +9,20 @@ var RotateMatrix = require('./RotateMatrix');
/**
* Rotates the array matrix 180 degrees.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.Rotate180
* @since 3.0.0
*

View file

@ -9,6 +9,20 @@ var RotateMatrix = require('./RotateMatrix');
/**
* Rotates the array matrix to the left (or 90 degrees)
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.RotateLeft
* @since 3.0.0
*

View file

@ -15,6 +15,20 @@ var TransposeMatrix = require('./TransposeMatrix');
*
* Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.RotateMatrix
* @since 3.0.0
*

View file

@ -9,6 +9,20 @@ var RotateMatrix = require('./RotateMatrix');
/**
* Rotates the array matrix to the left (or -90 degrees)
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.RotateRight
* @since 3.0.0
*

View file

@ -9,12 +9,26 @@
*
* The transpose of a matrix is a new matrix whose rows are the columns of the original.
*
* A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows)
* have the same length. There must be at least two rows. This is an example matrix:
*
* ```
* [
* [ 1, 1, 1, 1, 1, 1 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 2, 0, 1, 2, 0, 4 ],
* [ 2, 0, 3, 4, 0, 4 ],
* [ 2, 0, 0, 0, 0, 4 ],
* [ 3, 3, 3, 3, 3, 3 ]
* ]
* ```
*
* @function Phaser.Utils.Array.Matrix.TransposeMatrix
* @since 3.0.0
*
*
* @generic T
* @genericUse {T[][]} - [array,$return]
*
*
* @param {T[][]} [array] - The array matrix to transpose.
*
* @return {T[][]} A new array matrix which is a transposed version of the given array.