-
Hey! Is it possible to use variables in switch-cases? I want to implement something in a similar way like this: const text = 'I’m {age:number} years old{hasRegion|{true: from {region}, false:}}.';
const str = LLL(test, { age: 10, hasRegion: true, region: 'Asia' }); Expected output: const str = LLL(test, { age: 10, hasRegion: false }); Expected output: The output I get at the moment is Is that possible at all? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, thanks for your kind words :) No, this is currently not possible. It is not the prettiest code, but you could do it like this: const text = 'I’m {age:number} years old {appendix:string}'
const textAppendix = 'from {region}'
const region = 'Asia'
const str = LLL(text, { age: 11, appendix: region ? LLL(textAppendix, { region }) : '' }).trim() Do you really use the raw |
Beta Was this translation helpful? Give feedback.
Hi, thanks for your kind words :)
No, this is currently not possible.
It is not the prettiest code, but you could do it like this:
Do you really use the raw
LLL
function with plain strings instead of theLL
function with an dictionary object?