Skip to content

Commit

Permalink
Standardize trim and filter of instructions
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Micah Halter <micah@balena.io>
  • Loading branch information
mehalter committed Oct 25, 2022
1 parent dff5bdc commit b2f9e2b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/models/device-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,14 @@ const getDeviceTypeModel = function (deps: InjectedDependenciesParam) {
deviceType: interpolatedDeviceType,
});

let instructions: string[] = interpolatedHostOS.partials[installMethod];
if (baseInstructions) {
return Handlebars.compile(baseInstructions)({
instructions = Handlebars.compile(baseInstructions)({
...interpolatedHostOS,
instructions: interpolatedHostOS.partials[installMethod],
})
.split('\n')
.map((s) => s.trim())
.filter((s) => s);
} else {
return interpolatedHostOS.partials[installMethod];
instructions,
}).split('\n');
}
return instructions.map((s) => s.trim()).filter((s) => s);
} else {
return [];
}
Expand Down

0 comments on commit b2f9e2b

Please sign in to comment.