@constructor and @param formatting

This commit is contained in:
Abhishek Soni 2017-07-03 00:29:01 +05:30
parent fc06aee722
commit 88fd43fb07
14 changed files with 202 additions and 136 deletions

77
gulpfile.js vendored
View File

@ -13,6 +13,83 @@ const pkg = require('./package.json');
const jsprettify = require('gulp-jsbeautifier');
const babel = require('gulp-babel');
const stripComments = require('gulp-strip-comments');
const glob = require('glob');
gulp.task('refactor', ()=>{
glob('src/**/*.js', (err, files)=>{
files.forEach(file=>{
fs.readFile(file, (err,data)=>{
let dataString = data.toString();
let chunks = [];
let stream = false;
chunks = dataString.split("\n");
for (var i = 0; i < chunks.length; i++) {
if(stream){
if(chunks[i]===/(\s+\*\s+)|(\*\/)/g){
stream = !stream;
}else{
let temp7 = chunks[i].match(/\t+\s+\*\s+/g);
// console.log(temp7)
let temp = chunks[i].replace(/\t+\s+\*\s+/g, '');
// console.log(temp);
let paramName = temp.match(/(^\w+)/g);
if(paramName){
paramName = paramName[0];
let typeAndRest = temp.match(/(^\w+)+(\s+-\s+{)/g);
if(typeAndRest){
temp1 = temp.replace(typeAndRest, '');
temp2 = paramName + ' {' + temp1;
temp3 = temp7 + '@param ' + temp2;
// console.log(temp3);
chunks[i] = temp3
}
}
}
}else{
if(chunks[i].includes('Properties:')){
chunks[i] = chunks[i].slice(0,chunks[i].indexOf('P')) + '*';
stream = !stream;
}
}
}
// if(stream){
// if(chunks[i]===' *' || chunks[i]===' */'){
// stream = !stream;
// }else{
// chunks[i] = chunks[i].replace(/\*\s+/g, '');
// console.log(chunks[i]);
// let paramName = chunks[i].match(/(^\w+)/g)[0];
// let typeAndRest = chunks[i].match(/(^\w+)+(\s+-\s+{)/g)[0];
// chunks[i] = chunks[i].replace(typeAndRest, '');
// chunks[i] = paramName + ' {' + chunks[i];
// chunks[i] = ' * @param' + chunks[i];
// }
// }else{
// if(chunks[i].match(/^\s+\* Function:/g)){
// console.log(chunks[i]);
// console.log(chunks[i]);
// chunks[i] = chunks[i].replace('Function:','@name');
// chunks[i] = '';
/*} else if (chunks[i].startsWith(' ')){
stream = !stream;
} else if (chunks[i].startsWith(' * Returns:')) {
chunks[i] = '';
chunks[i+1] = ' * @returns' + chunks[i+1].replace(/^\*\s+/g, '');
}*/
// }
const finalData = chunks.join('\n');
fs.writeFile(file, finalData);
})
})
})
})
/// Build the scripts
gulp.task('build', function() {

View File

@ -22,7 +22,7 @@ module.exports = class CPUFunctionBuilder extends FunctionBuilderBase {
*
* Return the JS Function String optimized for cpu.
*
* @param functionName {String} Function name to trace from. If null, it returns the WHOLE builder stack
* @param functionName {String} Function name to trace from. If null, it returns the WHOLE builder stack
*
* Returns:
* {String} Function String
@ -47,9 +47,9 @@ module.exports = class CPUFunctionBuilder extends FunctionBuilderBase {
*
* Add a new sub-kernel to the current kernel instance
*
* @param jsFunction {Function} Sub-kernel function (JavaScript)
* @param paramNames {Array} Parameters of the sub-kernel
* @param returnType {Array} Return type of the subKernel
* @param jsFunction {Function} Sub-kernel function (JavaScript)
* @param paramNames {Array} Parameters of the sub-kernel
* @param returnType {Array} Return type of the subKernel
*
*/
addSubKernel(jsFunction, paramTypes, returnType) {

View File

@ -7,7 +7,7 @@ const BaseFunctionNode = require('../function-node-base');
*
* This handles all the raw state, converted state, etc. Of a single function.
*
* Properties:
* *
* functionName - {String} Name of the function
* jsFunction - {JS Function} The JS Function the node represents
* jsFunctionString - {String} jsFunction.toString()

View File

@ -19,7 +19,7 @@ const kernelString = require('./kernel-string');
module.exports = class CPUKernel extends KernelBase {
//
// [Constructor]
// @constructor
//
/**

View File

@ -20,7 +20,7 @@ module.exports = class CPURunner extends RunnerBase {
/**
* @name CPURunner
*
* @param settings {Object} Settings to instantiate properties in RunnerBase, with given values
* @param settings {Object} Settings to instantiate properties in RunnerBase, with given values
*
*/
constructor(settings) {

View File

@ -5,10 +5,9 @@
*
* This handles all the raw state, converted state, etc. Of a single function.
*
* Properties:
* nodeMap - {Object} Object map, where nodeMap[function] = new FunctionNode;
* gpu - {Object} The current gpu instance bound to this builder
* rootKernel - {Object} The root kernel object, contains the paramNames, dimensions etc.
* @param nodeMap - {Object} Object map, where nodeMap[function] = new FunctionNode;
* @param gpu - {Object} The current gpu instance bound to this builder
* @param rootKernel - {Object} The root kernel object, contains the paramNames, dimensions etc.
*
*/
module.exports = class FunctionBuilderBase {
@ -16,7 +15,7 @@ module.exports = class FunctionBuilderBase {
/**
* @name FunctionBuilderBase
*
* [Constructor] Blank constructor, which initializes the properties
* @constructor Blank constructor, which initializes the properties
*
*/
constructor(gpu) {
@ -30,11 +29,11 @@ module.exports = class FunctionBuilderBase {
*
* Instantiates a FunctionNode, and add it to the nodeMap
*
* @param gpu {GPU} The GPU instance
* @param functionName {String} Function name to assume, if its null, it attempts to extract from the function
* @param jsFunction {JS Function} JS Function to do conversion
* @param paramTypes {[String,...]|{variableName: Type,...}} Parameter type array, assumes all parameters are 'float' if null
* @param returnType {String} The return type, assumes 'float' if null
* @param gpu {GPU} The GPU instance
* @param functionName {String} Function name to assume, if its null, it attempts to extract from the function
* @param jsFunction {JS Function} JS Function to do conversion
* @param paramTypes {[String,...]|{variableName: Type,...}} Parameter type array, assumes all parameters are 'float' if null
* @param returnType {String} The return type, assumes 'float' if null
*
*/
addFunction(functionName, jsFunction, paramTypes, returnType) {
@ -46,7 +45,7 @@ module.exports = class FunctionBuilderBase {
*
* Add the funciton node directly
*
* @param inNode {functionNode} functionNode to add
* @param inNode {functionNode} functionNode to add
*
*/
addFunctionNode(inNode) {
@ -64,8 +63,8 @@ module.exports = class FunctionBuilderBase {
* This allow for 'unneeded' functions to be automatically optimized out.
* Note that the 0-index, is the starting function trace.
*
* @param functionName {String} Function name to trace from, default to 'kernel'
* @param retList {[String,...]} Returning list of function names that is traced. Including itself.
* @param functionName {String} Function name to trace from, default to 'kernel'
* @param retList {[String,...]} Returning list of function names that is traced. Including itself.
*
* Returns:
* {[String,...]} Returning list of function names that is traced. Including itself.

View File

@ -8,19 +8,18 @@ const parser = require('../core/parser').parser;
*
* This handles all the raw state, converted state, etc. Of a single function.
*
* Properties:
* functionName - {String} Name of the function
* jsFunction - {JS Function} The JS Function the node represents
* jsFunctionString - {String} jsFunction.toString()
* paramNames - {[String,...]} Parameter names of the function
* paramTypes - {[String,...]} Shader land parameters type assumption
* isRootKernel - {Boolean} Special indicator, for kernel function
* webglFunctionString - {String} webgl converted function string
* openglFunctionString - {String} opengl converted function string
* calledFunctions - {[String,...]} List of all the functions called
* initVariables - {[String,...]} List of variables initialized in the function
* readVariables - {[String,...]} List of variables read operations occur
* writeVariables - {[String,...]} List of variables write operations occur
* @param functionName - {String} Name of the function
* @param jsFunction - {JS Function} The JS Function the node represents
* @param jsFunctionString - {String} jsFunction.toString()
* @param paramNames - {[String,...]} Parameter names of the function
* @param paramTypes - {[String,...]} Shader land parameters type assumption
* @param isRootKernel - {Boolean} Special indicator, for kernel function
* @param webglFunctionString - {String} webgl converted function string
* @param openglFunctionString - {String} opengl converted function string
* @param calledFunctions - {[String,...]} List of all the functions called
* @param initVariables - {[String,...]} List of variables initialized in the function
* @param readVariables - {[String,...]} List of variables read operations occur
* @param writeVariables - {[String,...]} List of variables write operations occur
*
*/
module.exports = class BaseFunctionNode {
@ -32,13 +31,13 @@ module.exports = class BaseFunctionNode {
/**
* @name FunctionNodeBase
*
* [Constructor] Builds the function with the given JS function, and argument type array.
* @constructor Builds the function with the given JS function, and argument type array.
*
* @param gpu {GPU} The GPU instance
* @param functionName {String} Function name to assume, if its null, it attempts to extract from the function
* @param jsFunction {JS Function / String} JS Function to do conversion
* @param paramTypes {[String,...]|{variableName: Type}} Parameter type array, assumes all parameters are 'float' if null
* @param returnType {String} The return type, assumes 'float' if null
* @param gpu {GPU} The GPU instance
* @param functionName {String} Function name to assume, if its null, it attempts to extract from the function
* @param jsFunction {JS Function / String} JS Function to do conversion
* @param paramTypes {[String,...]|{variableName: Type}} Parameter type array, assumes all parameters are 'float' if null
* @param returnType {String} The return type, assumes 'float' if null
*
*/
constructor(functionName, jsFunction, options, paramTypes, returnType) {
@ -196,7 +195,7 @@ module.exports = class BaseFunctionNode {
*
* This is used internally to convert to shader code
*
* @param inParser {JISON Parser} Parser to use, assumes in scope 'parser' if null
* @param inParser {JISON Parser} Parser to use, assumes in scope 'parser' if null
*
* Returns:
* {AST Object} The function AST Object, note that result is cached under this.jsFunctionAST;
@ -244,7 +243,7 @@ module.exports = class BaseFunctionNode {
*
* Set the functionString value, overwriting it
*
* @param functionString {String} Shader code string, representing the function
* @param functionString {String} Shader code string, representing the function
*
*/
setFunctionString(functionString) {
@ -256,7 +255,7 @@ module.exports = class BaseFunctionNode {
*
* Return the type of parameter sent to subKernel/Kernel.
*
* @param paramName {String} Name of the parameter
* @param paramName {String} Name of the parameter
*
* Returns:
* {String} Type of the parameter
@ -283,7 +282,7 @@ module.exports = class BaseFunctionNode {
* Return the name of the *user parameter*(subKernel parameter) corresponding
* to the parameter supplied to the kernel
*
* @param paramName {String} Name of the parameter
* @param paramName {String} Name of the parameter
*
* Returns:
* {String} Name of the parameter

View File

@ -9,17 +9,16 @@ const utils = require('../core/utils');
* This contains the basic methods needed by all Kernel implementations,
* like setDimensions, addSubKernel, etc.
*
* Properties:
* paramNames - {Array} Name of the parameters of the kernel function
* fnString - {String} Kernel function as a String
* dimensions - {Array} Dimensions of the kernel function, this.thread.x, etc.
* debug - {Boolean} Toggle debug mode
* graphical - {String} Toggle graphical mode
* loopMaxIterations - {Number} Maximum number of loop iterations
* constants - {Object} Global constants
* subKernels - {Array} Sub kernels bound to this kernel instance
* subKernelProperties - {Object} Sub kernels bound to this kernel instance as key/value pairs
* subKernelOutputVariableNames - {Array} Names of the variables outputted by the subkerls
* @param paramNames - {Array} Name of the parameters of the kernel function
* @param fnString - {String} Kernel function as a String
* @param dimensions - {Array} Dimensions of the kernel function, this.thread.x, etc.
* @param debug - {Boolean} Toggle debug mode
* @param graphical - {String} Toggle graphical mode
* @param loopMaxIterations - {Number} Maximum number of loop iterations
* @param constants - {Object} Global constants
* @param subKernels - {Array} Sub kernels bound to this kernel instance
* @param subKernelProperties - {Object} Sub kernels bound to this kernel instance as key/value pairs
* @param subKernelOutputVariableNames - {Array} Names of the variables outputted by the subkerls
*
*/
module.exports = class BaseKernel {
@ -27,7 +26,7 @@ module.exports = class BaseKernel {
/**
* @name BaseKernel
*
* [Constructor] Blank constructor, which initializes the properties
* @constructor Blank constructor, which initializes the properties
*
*/
constructor(fnString, settings) {
@ -80,7 +79,7 @@ module.exports = class BaseKernel {
*
* Set dimensions of the kernel function
*
* @param dimensions {Array} The dimensions array set the dimensions to
* @param dimensions {Array} The dimensions array set the dimensions to
*
*/
setDimensions(dimensions) {
@ -93,7 +92,7 @@ module.exports = class BaseKernel {
*
* Toggle debug mode
*
* @param flag {Boolean} true to enable debug
* @param flag {Boolean} true to enable debug
*
*/
setDebug(flag) {
@ -106,7 +105,7 @@ module.exports = class BaseKernel {
*
* Toggle graphical output mode
*
* @param flag {Boolean} true to enable graphical output
* @param flag {Boolean} true to enable graphical output
*
*/
setGraphical(flag) {
@ -119,7 +118,7 @@ module.exports = class BaseKernel {
*
* Set the maximum number of loop iterations
*
* @param max {Number} iterations count
* @param max {Number} iterations count
*
*/
setLoopMaxIterations(max) {
@ -157,7 +156,7 @@ module.exports = class BaseKernel {
*
* Toggle texture output mode
*
* @param flag {Boolean} true to enable floatTextures
* @param flag {Boolean} true to enable floatTextures
*
*/
setFloatTextures(flag) {
@ -170,7 +169,7 @@ module.exports = class BaseKernel {
*
* Toggle output mode
*
* @param flag {Boolean} true to enable float
* @param flag {Boolean} true to enable float
*
*/
setFloatOutput(flag) {
@ -188,7 +187,7 @@ module.exports = class BaseKernel {
*
* Bind the canvas to kernel
*
* @param canvas {Canvas} Canvas to bind
* @param canvas {Canvas} Canvas to bind
*
*/
setCanvas(canvas) {
@ -201,7 +200,7 @@ module.exports = class BaseKernel {
*
* Bind the webGL instance to kernel
*
* @param webGL {Canvas} webGL instance to bind
* @param webGL {Canvas} webGL instance to bind
*
*/
setWebGl(webGl) {
@ -268,7 +267,7 @@ module.exports = class BaseKernel {
* Add a sub kernel to the root kernel instance.
* This is what `createKernels` uses.
*
* @param fnString {String} function (as a String) of the subKernel to add
* @param fnString {String} function (as a String) of the subKernel to add
*
*/
addSubKernel(fnString) {
@ -286,8 +285,8 @@ module.exports = class BaseKernel {
* Add a sub kernel to the root kernel instance, indexed by a property name
* This is what `createKernels` uses.
*
* @param property {String} property key for the subKernel
* @param fnString {String} function (as a String) of the subKernel to add
* @param property {String} property key for the subKernel
* @param fnString {String} function (as a String) of the subKernel to add
*
*/
addSubKernelProperty(property, fnString) {

View File

@ -14,15 +14,14 @@ const kernelRunShortcut = require('./kernel-run-shortcut');
* File isolation is currently the best way to go
*
*
* Properties:
* settings - {Object} Settings object used to set Dimensions, etc.
* kernel - {String} Current kernel instance
* canvas - {Object} Canvas instance attached to the kernel
* webGl - {Object} WebGl instance attached to the kernel
* fn - {Function} Kernel function to run
* functionBuilder - {Object} FunctionBuilder instance
* fnString - {String} Kernel function (as a String)
* endianness - {String} endian information like Little-endian, Big-endian.
* @param settings - {Object} Settings object used to set Dimensions, etc.
* @param kernel - {String} Current kernel instance
* @param canvas - {Object} Canvas instance attached to the kernel
* @param webGl - {Object} WebGl instance attached to the kernel
* @param fn - {Function} Kernel function to run
* @param functionBuilder - {Object} FunctionBuilder instance
* @param fnString - {String} Kernel function (as a String)
* @param endianness - {String} endian information like Little-endian, Big-endian.
*
*/
@ -31,7 +30,7 @@ module.exports = class BaseRunner {
/**
* @name BaseRunner
*
* [Constructor] Blank constructor, which initializes the properties related to runner
* @constructor Blank constructor, which initializes the properties related to runner
*
*/
constructor(functionBuilder, settings) {
@ -51,7 +50,7 @@ module.exports = class BaseRunner {
*
* Converts the provided Texture instance to a JavaScript Array
*
* @param texture {Object}
* @param texture {Object}
*
*/
textureToArray(texture) {
@ -67,7 +66,7 @@ module.exports = class BaseRunner {
*
* Deletes the provided Texture instance
*
* @param texture {Object}
* @param texture {Object}
*/
deleteTexture(texture) {
this.webGl.deleteTexture(texture.texture);

View File

@ -21,7 +21,7 @@ module.exports = class WebGLFunctionBuilder extends FunctionBuilderBase {
/**
* @name getStringFromFunctionNames
*
* @param functionList {[String,...]} List of function to build the webgl string.
* @param functionList {[String,...]} List of function to build the webgl string.
*
* Returns:
* {String} The full webgl string, of all the various functions. Trace optimized if functionName given
@ -43,8 +43,8 @@ module.exports = class WebGLFunctionBuilder extends FunctionBuilderBase {
*
* Return webgl String of all functions converted to webgl shader form
*
* @param functionList {[String,...]} List of function names to build the webgl string.
* @param opt {Object} Settings object passed to functionNode. See functionNode for more details.
* @param functionList {[String,...]} List of function names to build the webgl string.
* @param opt {Object} Settings object passed to functionNode. See functionNode for more details.
*
* Returns:
* {String} Prototype String of all functions converted to webgl shader form
@ -64,7 +64,7 @@ module.exports = class WebGLFunctionBuilder extends FunctionBuilderBase {
/**
* @name getString
*
* @param functionName {String} Function name to trace from. If null, it returns the WHOLE builder stack
* @param functionName {String} Function name to trace from. If null, it returns the WHOLE builder stack
*
* Returns:
* {String} The full webgl string, of all the various functions. Trace optimized if functionName given
@ -86,7 +86,7 @@ module.exports = class WebGLFunctionBuilder extends FunctionBuilderBase {
*
* Return the webgl string for a function converted to glsl (webgl shaders)
*
* @param functionName {String} Function name to trace from. If null, it returns the WHOLE builder stack
* @param functionName {String} Function name to trace from. If null, it returns the WHOLE builder stack
*
* Returns:
* {String} The full webgl string, of all the various functions. Trace optimized if functionName given
@ -105,10 +105,10 @@ module.exports = class WebGLFunctionBuilder extends FunctionBuilderBase {
*
* Add a new kernel to this instance
*
* @param fnString {String} Kernel function as a String
* @param options {Object} Settings object to set constants, debug mode, etc.
* @param paramNames {Array} Parameters of the kernel
* @param paramTypes {Array} Types of the parameters
* @param fnString {String} Kernel function as a String
* @param options {Object} Settings object to set constants, debug mode, etc.
* @param paramNames {Array} Parameters of the kernel
* @param paramTypes {Array} Types of the parameters
*
*
* Returns:
@ -130,10 +130,10 @@ module.exports = class WebGLFunctionBuilder extends FunctionBuilderBase {
*
* Add a new sub-kernel to the current kernel instance
*
* @param jsFunction {Function} Sub-kernel function (JavaScript)
* @param options {Object} Settings object to set constants, debug mode, etc.
* @param paramNames {Array} Parameters of the sub-kernel
* @param returnType {Array} Return type of the subKernel
* @param jsFunction {Function} Sub-kernel function (JavaScript)
* @param options {Object} Settings object to set constants, debug mode, etc.
* @param paramNames {Array} Parameters of the sub-kernel
* @param returnType {Array} Return type of the subKernel
*
* Returns:
* {Object} The inserted sub-kernel as a Kernel Node

View File

@ -16,26 +16,25 @@ const kernelString = require('./kernel-string');
* Extends:
* KernelBase
*
* Properties:
* textureCache - {Object} webGl Texture cache
* threadDim - {Object} The thread dimensions, x, y and z
* programUniformLocationCache - {Object} Location of program variables in memory
* framebuffer - {Object} Webgl frameBuffer
* buffer - {Object} WebGL buffer
* program - {Object} The webGl Program
* functionBuilder - {Object} Function Builder instance bound to this Kernel
* outputToTexture - {Boolean} Set output type to Texture, instead of float
* endianness - {String} Endian information like Little-endian, Big-endian.
* paramTypes - {Array} Types of parameters sent to the Kernel
* argumentsLength - {Number} Number of parameters sent to the Kernel
* compiledFragShaderString - {String} Compiled fragment shader string
* compiledVertShaderString - {String} Compiled Vertical shader string
* @param textureCache - {Object} webGl Texture cache
* @param threadDim - {Object} The thread dimensions, x, y and z
* @param programUniformLocationCache - {Object} Location of program variables in memory
* @param framebuffer - {Object} Webgl frameBuffer
* @param buffer - {Object} WebGL buffer
* @param program - {Object} The webGl Program
* @param functionBuilder - {Object} Function Builder instance bound to this Kernel
* @param outputToTexture - {Boolean} Set output type to Texture, instead of float
* @param endianness - {String} Endian information like Little-endian, Big-endian.
* @param paramTypes - {Array} Types of parameters sent to the Kernel
* @param argumentsLength - {Number} Number of parameters sent to the Kernel
* @param compiledFragShaderString - {String} Compiled fragment shader string
* @param compiledVertShaderString - {String} Compiled Vertical shader string
*
*/
module.exports = class WebGLKernel extends KernelBase {
//
// [Constructor]
// @constructor
//
/**
@ -441,7 +440,6 @@ module.exports = class WebGLKernel extends KernelBase {
* Setup the parameter types for the parameters
* supplied to the Kernel function
*
* @param args {Array} The actual parameters sent to the Kernel
*
*/
@ -477,7 +475,6 @@ module.exports = class WebGLKernel extends KernelBase {
* Generate Shader artifacts for the kernel program.
* The final object contains HEADER, KERNEL, MAIN_RESULT, and others.
*
* @param args {Array} The actual parameters sent to the Kernel
*
* Returns:
@ -508,7 +505,6 @@ module.exports = class WebGLKernel extends KernelBase {
* Adds kernel parameters to the Argument Texture,
* binding it to the webGl instance, etc.
*
* @param value {Array|Texture|Number} The actual argument supplied to the kernel
* @param type {String} Type of the argument
* @param name {String} Name of the argument
@ -965,9 +961,8 @@ module.exports = class WebGLKernel extends KernelBase {
/**
* @name _replaceArtifacts
*
* @param src {String} Name of the subkernel, argument, or kernel.
* @param map {String} Name of the subkernel, argument, or kernel.
* @param src {String} Shader string
* @param map {Array} Variables/Constants associated with shader
*
* Returns:
* Texture cache
@ -1044,7 +1039,6 @@ module.exports = class WebGLKernel extends KernelBase {
* If the String hasn't been compiled yet,
* then this method compiles it as well
*
* @param args {Array} The actual parameters sent to the Kernel
*
* Returns:
@ -1063,7 +1057,6 @@ module.exports = class WebGLKernel extends KernelBase {
*
* Get the vertical shader String
*
* @param args {Array} The actual parameters sent to the Kernel
*
* Returns:

View File

@ -20,7 +20,7 @@ module.exports = class GPUCore {
*
* For the kernel object format see : <kernelObj-format>
*
* @param kernelObj {Object|String} KernelObj used to validate
* @param kernelObj {Object|String} KernelObj used to validate
*
* Returns:
* <Object> The validated kernel object, converted from JSON if needed

View File

@ -24,7 +24,7 @@ class UtilsCore {
*
* Note: This does just a VERY simply sanity check. And may give false positives.
*
* @param canvasObj {Canvas DOM object} Object to validate
* @param canvasObj {Canvas DOM object} Object to validate
*
* Returns:
* {Boolean} TRUE if the object is a DOM canvas
@ -92,7 +92,7 @@ class UtilsCore {
*
* Note: This does just a VERY simply sanity check. And may give false positives.
*
* @param webGlObj {webGl context} Object to validate
* @param webGlObj {webGl context} Object to validate
*
* Returns:
* {Boolean} TRUE if the object is a webgl context object
@ -146,7 +146,7 @@ class UtilsCore {
* Initiate and returns a webGl, from a canvas object
* Returns only if webGl is supported by browser.
*
* @param canvasObj {Canvas DOM object} Object to validate
* @param canvasObj {Canvas DOM object} Object to validate
*
* Returns:
* {Canvas DOM object} Canvas dom object if supported by browser, else null

View File

@ -63,7 +63,7 @@ class Utils extends UtilsCore {
*
* Return TRUE, on a JS function
*
* @param funcObj {JS Function} Object to validate if its a function
* @param funcObj {JS Function} Object to validate if its a function
*
* Returns:
* {Boolean} TRUE if the object is a JS function
@ -80,7 +80,7 @@ class Utils extends UtilsCore {
*
* Note: This does just a VERY simply sanity check. And may give false positives.
*
* @param funcStr {String} String of JS function to validate
* @param funcStr {String} String of JS function to validate
*
* Returns:
* {Boolean} TRUE if the string passes basic validation
@ -100,7 +100,7 @@ class Utils extends UtilsCore {
*
* Return the function name from a JS function string
*
* @param funcStr {String} String of JS function to validate
* @param funcStr {String} String of JS function to validate
*
* Returns:
* {String} Function name string (if found)
@ -119,7 +119,7 @@ class Utils extends UtilsCore {
*
* Return list of parameter names extracted from the JS function string
*
* @param funcStr {String} String of JS function to validate
* @param funcStr {String} String of JS function to validate
*
* Returns:
* {[String, ...]} Array representing all the parameter names
@ -144,7 +144,7 @@ class Utils extends UtilsCore {
*
* Returns a clone
*
* @param obj {Object} Object to clone
* @param obj {Object} Object to clone
*
* Returns:
* {Object} Cloned object
@ -171,7 +171,7 @@ class Utils extends UtilsCore {
*
* Returns a `new Promise` object based on the underlying implmentation
*
* @param executor {function(resolve,reject)} Promise builder function
* @param executor {function(resolve,reject)} Promise builder function
*
* Returns:
* {Promise} Promise object
@ -190,8 +190,8 @@ class Utils extends UtilsCore {
*
* Limited implementation of Function.bind, with fallback
*
* @param inFunc {JS Function} to setup bind on
* @param thisObj {Object} The this parameter to assume inside the binded function
* @param inFunc {JS Function} to setup bind on
* @param thisObj {Object} The this parameter to assume inside the binded function
*
* Returns:
* {JS Function} The binded function
@ -213,7 +213,7 @@ class Utils extends UtilsCore {
*
* Checks if is an array or Array-like object
*
* @param arg {Object} The argument object to check if is array
* @param arg {Object} The argument object to check if is array
*
* Returns:
* {Boolean} true if is array or Array-like object
@ -229,7 +229,7 @@ class Utils extends UtilsCore {
*
* Evaluate the argument type, to apply respective logic for it
*
* @param arg {Object} The argument object to evaluate type
* @param arg {Object} The argument object to evaluate type
*
* Returns:
* {String} Argument type Array/Number/Texture/Unknown
@ -252,7 +252,7 @@ class Utils extends UtilsCore {
*
* Checks if the browser supports readPixels with float type
*
* @param gpu {gpu.js object} the gpu object
* @param gpu {gpu.js object} the gpu object
*
* Returns:
* {Boolean} true if browser supports
@ -300,8 +300,8 @@ class Utils extends UtilsCore {
*
* Return the dimension of an array.
*
* @param x {Array} The array
* @param pad {Number} To include padding in the dimension calculation [Optional]
* @param x {Array} The array
* @param pad {Number} To include padding in the dimension calculation [Optional]
*
*
*
@ -338,8 +338,8 @@ class Utils extends UtilsCore {
*
* Pad an array AND its elements with leading and ending zeros
*
* @param arr {Array} the array to pad zeros to
* @param padding {Number} amount of padding
* @param arr {Array} the array to pad zeros to
* @param padding {Number} amount of padding
*
* Returns:
* {Array} Array with leading and ending zeros, and all the elements padded by zeros.
@ -368,7 +368,7 @@ class Utils extends UtilsCore {
*
* Converts a nested array into a one-dimensional array
*
* @param _arr {Array} the nested array to flatten
* @param _arr {Array} the nested array to flatten
*
* Returns:
* {Array} 1D Array
@ -402,8 +402,8 @@ class Utils extends UtilsCore {
* Splits an array into smaller arrays.
* Number of elements in one small chunk is given by `part`
*
* @param array {Array} The array to split into chunks
* @param part {Array} elements in one chunk
* @param array {Array} The array to split into chunks
* @param part {Array} elements in one chunk
*
* Returns:
* {Array} An array of smaller chunks