binary-parser icon indicating copy to clipboard operation
binary-parser copied to clipboard

choices on string

Open ThodorisElissaios opened this issue 5 years ago • 1 comments

how can this work ?

ThodorisElissaios avatar Dec 24 '19 16:12 ThodorisElissaios

This is the way I worked around the numbers only choice limitation:

choice({
  tag : function() { return ["ABC", "MNO", "XYZ"].indexOf(this.someVar)+1 || -1; },
  choices :
  {
    1 : abcParser,
    2 : mnoParser,
    3 : xyzParser
  },
  defaultChoice : unknownParser
});

Sembiance avatar May 09 '20 17:05 Sembiance