1 | /**
|
2 | * Returns the category of the given parameter corresponding to the encoded integer value.
|
3 | *
|
4 | * @param {Parameter} parameter
|
5 | * @param {number} val
|
6 | * @return {Category}
|
7 | */
|
8 | export function getCategory (parameter, val) {
|
9 | for (let [catId, vals] of parameter.categoryEncoding) {
|
10 | if (vals.indexOf(val) !== -1) {
|
11 | let cat = parameter.observedProperty.categories.filter(c => c.id === catId)[0]
|
12 | return cat
|
13 | }
|
14 | }
|
15 | }
|