Skip to content

Commit

Permalink
fix: Add sort ascending by string length in versions.tf files keys ar…
Browse files Browse the repository at this point in the history
…ray (#15)

Co-authored-by: Juan Ramón Sixto Anello <[email protected]>
  • Loading branch information
bryantbiggs and jotasixto authored Nov 12, 2022
1 parent 3411591 commit 8250970
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const regExprRequiredVersion = /(?<=(required_version.=.)).*/;

export async function versionConstraintSearch(dir: string): Promise<string> {
const files = await findInFiles.find('required_versions*s*', dir, '.tf$');
const key = Object.keys(files)[0];
const key = Object.keys(files).sort((a, b) => a.length - b.length)[0];
const line = files[key].line;

if (line) {
Expand Down

0 comments on commit 8250970

Please sign in to comment.