dice-roller/rpg-dice-roller

Support ternary operator

Ouverte

#240 ouverte le 17 janv. 2022

 (4 commentaires) (0 réaction) (0 personne assignée)JavaScript (68 forks)auto 404
enhancementgood first issue

Métriques du dépôt

Stars
 (279 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Is your feature request related to a problem? Please describe. In the tool I'm writing currently I use mustache for user side templating and this lib to "evaluate" the values. For some expression it would be easier and cleaner to write and use them if this lib would support ternary operations.

Describe the solution you'd like Support writing a ? b : c which returns b if a is non-zero and c if a is zero. With this the comparison operators should also work with just naked numbers so that the following expression would also work 1>0 ? 100 : 0.

Describe alternatives you've considered I can always write my own parser on top of this lib and I might have to do that at some point anyways. 😅

Guide contributeur