Skip to content

Commit

Permalink
test code interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Aug 13, 2023
1 parent 0cb03c7 commit 83ef921
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Evaluator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import type { Editor } from './main';
import type { File } from './AppSettings';

function codeInterceptor(code: string) {
return code.replace(/->/g, "&&")
function codeInterceptor(code: string): string {
return code
.replace(/->/g, "&&")
.replace(/t\[(\d+),(\d+)\]/g, 'mod($1,$2)')
.replace(/b\[(\d+),(\d+)\]/g, '[$1,$2].includes(beat)')
.replace(/eb\[(\d+),(\d+)\]/g, '[$1,$2].includes(ebeat)')
.replace(/m\[(\d+),(\d+)\]/g, '[$1,$2].includes(bar)');
}

const delay = (ms: number) => new Promise((_, reject) => setTimeout(() => reject(new Error('Operation took too long')), ms));
Expand Down

0 comments on commit 83ef921

Please sign in to comment.