src/app/www/js/functions.js
/**
 * Undos some of the changes of `preProcessCode` to show the script as if in
 * normal Duckyscript.
 * The main changes are:
 *  * REPEAT command is reversed back to its normal order (see `preProcessCode`)
 *  * KEYS command is omitted
 * This, however, doesn't restore any comments.
 * @param {String} content 
 */
Undos some of the changes of `preProcessCode` to show the script as if in
normal Duckyscript.
The main changes are:
REPEAT command is reversed back to its normal order
KEYS command is omitted
This, however, doesn't restore any comments.
@param {String} content
Undos some of the changes of ` preProcessCode ` to show the script as if in normal Duckyscript . The main changes are : REPEAT command is reversed back to its normal order KEYS command is omitted This however doesn ' t restore any comments . @param { String } content
function deProcessCode(content) {
    let lines = content.split('\n');
    for(let i = lines.length - 1; i >= 0; i--) {
        const command = lines[i].split(' ')[0];
        if(command == "REPEAT") {
            const temp = lines[i + 1];
            lines[i + 1] = lines[i];
            lines[i] = temp;
        }
        else if(command == "KEYS") {
            lines[i] = lines[i].slice("KEYS ".length);
        }
    }
    return lines.join('\n');
}
function deProcessCode ( content ) { let lines = content . split ( '\n' ) ; for ( let i = lines . length - 1 ; i >= 0 ; i -- ) { const command = lines [ i ] . split ( ' ' ) [ 0 ] ; if ( command == "REPEAT" ) { const temp = lines [ i + 1 ] ; lines [ i + 1 ] = lines [ i ] ; lines [ i ] = temp ; } else if ( command == "KEYS" ) { lines [ i ] = lines [ i ] . slice ( "KEYS " . length ) ; } } return lines . join ( '\n' ) ; }
Undos some of the changes of `preProcessCode` to show the script as if in
 normal Duckyscript.
Undos some of the changes of ` preProcessCode ` to show the script as if in normal Duckyscript .