Skip to content

Commit

Permalink
fix: multiple repls
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Nov 17, 2023
1 parent 83561a0 commit 0975224
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions packages/core/repl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,22 @@ export function repl({
allTransform = transform;
return silence;
};

for (let i = 1; i < 10; ++i) {
Object.defineProperty(Pattern.prototype, `d${i}`, {
get() {
return this.p(i);
},
});
Object.defineProperty(Pattern.prototype, `p${i}`, {
get() {
return this.p(i);
},
});
Pattern.prototype[`q${i}`] = silence;
try {
for (let i = 1; i < 10; ++i) {
Object.defineProperty(Pattern.prototype, `d${i}`, {
get() {
return this.p(i);
},
});
Object.defineProperty(Pattern.prototype, `p${i}`, {
get() {
return this.p(i);
},
});
Pattern.prototype[`q${i}`] = silence;
}
} catch (err) {
// already defined..
}

const fit = register('fit', (pat) =>
Expand Down

0 comments on commit 0975224

Please sign in to comment.