leetgo icon indicating copy to clipboard operation
leetgo copied to clipboard

Added pre submit code modifiers

Open tsych0 opened this issue 10 months ago • 1 comments

added modifiers for modifying code just before submission

example usage:

  kotlin:
    out_dir: src
    post-modifiers:
      - script: |
          function modify(code) {
             return `class Solution {\n    ${code.split('\n').join('\n    ')}\n}`;
          }
    modifiers:
      - name: removeUselessComments
      - script: |
          function modify(code) {
            const functionBodyMatch = code.match(/class Solution \{([\s\S]+)\}/);
            if (functionBodyMatch) {
              return functionBodyMatch[1].trim(); 
            }
            return '';          
          }

tsych0 avatar Dec 25 '24 10:12 tsych0