Skip to content

Commit

Permalink
chore: move function out of the command
Browse files Browse the repository at this point in the history
  • Loading branch information
ihexxa committed Oct 31, 2024
1 parent ccbcf38 commit 88c66bc
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions packages/insomnia-inso/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,23 +531,6 @@ export const go = (args?: string[]) => {
return process.exit(1);
}

const getNextRequestOffset = (
leftRequestsToRun: BaseModel[],
nextRequestIdOrName: string
) => {
const idMatchOffset = leftRequestsToRun.findIndex(req => req._id.trim() === nextRequestIdOrName.trim());
if (idMatchOffset >= 0) {
return idMatchOffset;
}

const nameMatchOffset = leftRequestsToRun.reverse().findIndex(req => req.name.trim() === nextRequestIdOrName.trim());
if (nameMatchOffset >= 0) {
return leftRequestsToRun.length - 1 - nameMatchOffset;
}

return leftRequestsToRun.length;
};

try {
const iterationCount = parseInt(options.iterationCount, 10);

Expand Down Expand Up @@ -742,3 +725,20 @@ Test results:`);

program.parseAsync(args || process.argv).catch(logErrorAndExit);
};

const getNextRequestOffset = (
leftRequestsToRun: BaseModel[],
nextRequestIdOrName: string
) => {
const idMatchOffset = leftRequestsToRun.findIndex(req => req._id.trim() === nextRequestIdOrName.trim());
if (idMatchOffset >= 0) {
return idMatchOffset;
}

const nameMatchOffset = leftRequestsToRun.reverse().findIndex(req => req.name.trim() === nextRequestIdOrName.trim());
if (nameMatchOffset >= 0) {
return leftRequestsToRun.length - 1 - nameMatchOffset;
}

return leftRequestsToRun.length;
};

0 comments on commit 88c66bc

Please sign in to comment.