Skip to content

⬅️ Back to Table of Contents

📄 TranspilerUtils.js

📊 Analysis Summary

Metric Count
🔧 Functions 4

📚 Table of Contents

🛠️ File Location:

📂 examples/jsm/transpiler/TranspilerUtils.js

Functions

isExpression(st: any): boolean

Parameters:

  • st any

Returns: boolean

Code
export function isExpression( st ) {

    return st.isFunctionDeclaration !== true && st.isFor !== true && st.isWhile !== true && st.isConditional !== true && st.isSwitch !== true;

}

isPrimitive(value: any): boolean

Parameters:

  • value any

Returns: boolean

Calls:

  • /^(true|false|-?(\d|\.\d))/.test
Code
export function isPrimitive( value ) {

    return /^(true|false|-?(\d|\.\d))/.test( value );

}

isType(str: any): boolean

Parameters:

  • str any

Returns: boolean

Calls:

  • /void|bool|float|u?int|mat[234]|mat[234]x[234]|(u|i|b)?vec[234]/.test
Code
export function isType( str ) {

    return /void|bool|float|u?int|mat[234]|mat[234]x[234]|(u|i|b)?vec[234]/.test( str );

}

toFloatType(type: any): any

Parameters:

  • type any

Returns: any

Calls:

  • /^(i?int)$/.test
  • /^(i|u)?vec([234])$/.exec
Code
export function toFloatType( type ) {

    if ( /^(i?int)$/.test( type ) ) return 'float';

    const vecMatch = /^(i|u)?vec([234])$/.exec( type );

    if ( vecMatch ) return 'vec' + vecMatch[ 2 ];

    return type;

}