Skip to content

Commit

Permalink
feat(perform): use spread array syntax for steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
asafkorem committed Sep 26, 2024
1 parent 7e98c8c commit 90d9421
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ const copilot: CopilotFacade = {
reset: () => {
Copilot.getInstance().reset();
},
perform: async (steps: string | string[]) => {
perform: async (...steps: string[]) => {
const copilotInstance = Copilot.getInstance();

const intents = Array.isArray(steps) ? steps : [steps];
const results = new Array<any>();
for (const intent of intents) {
for (const intent of steps) {
results.push(await copilotInstance.performStep(intent));
}

Expand Down
7 changes: 2 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ export interface CopilotFacade {
* @example Scroll down to the 7th item in the Events list
* @example The welcome message should be visible
* @example The welcome message text should be "Hello, world!"
* @example [
* 'Tap on the login button',
* 'A login form should be visible',
* ]
* @example 'Tap on the login button', 'A login form should be visible'
*/
perform: (steps: string | string[]) => Promise<any | any[]>;
perform: (...steps: string[]) => Promise<any | any[]>;
}

/**
Expand Down

0 comments on commit 90d9421

Please sign in to comment.