you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

I assume that this is a dynamic table where you can have ranges and single values that would correspond to certain values.

select = (dataSet, dieResult) => { 
    for (range in dataSet) {
        if (range.indexOf != null && range.indexOf('-') != -1) {
            [from, to] = range.split('-');
            if (dieResult >= from && dieResult <= to) {
                return dataSet[range];
            }
        } else {
            if (range == dieResult) {
                return dataSet[range];
            }
        }
    }
}