Skip to content

Commit

Permalink
refactor(uri): more concise choice variable setting
Browse files Browse the repository at this point in the history
Co-authored-by: Chainarong Tangsurakit <[email protected]>
  • Loading branch information
Ovyerus and chaintng committed Feb 20, 2025
1 parent 7c9680c commit bfcd85f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,11 @@ export default class QuickAdd extends Plugin {
}

const choiceExecutor = new ChoiceExecutor(this.app, this);

const vars = Object.entries(parameters)
Object.entries(parameters)
.filter(([key]) => key.startsWith("value-"))
.map(
([key, value]) => [key.slice(6), value] as [string, string]
);

vars.forEach(([key, value]) => {
choiceExecutor.variables.set(key, value);
});
.forEach(([key, value]) => {
choiceExecutor.variables.set(key.slice(6), value);
});

try {
await choiceExecutor.execute(choice);
Expand Down

0 comments on commit bfcd85f

Please sign in to comment.