Variables: Support raw values of boolean type (#34727) (#35075)

(cherry picked from commit 4137534650)

Co-authored-by: Simon Podlipsky <simon@podlipsky.net>
This commit is contained in:
Grot (@grafanabot)
2021-06-02 07:03:38 +02:00
committed by GitHub
co-authored by Simon Podlipsky
parent 5bb876f414
commit 4344975654
2 changed files with 5 additions and 0 deletions
@@ -169,6 +169,7 @@ describe('ensureStringValues', () => {
${[1, 2]} | ${['1', '2']}
${'1'} | ${'1'}
${['1', '2']} | ${['1', '2']}
${true} | ${'true'}
`('when called with value:$value then result should be:$expected', ({ value, expected }) => {
expect(ensureStringValues(value)).toEqual(expected);
});
+4
View File
@@ -239,5 +239,9 @@ export function ensureStringValues(value: any | any[]): string | string[] {
return value;
}
if (typeof value === 'boolean') {
return value.toString();
}
return '';
}