• Returns an expression that maps an index onto an expression. The expression first determines an index, then evaluates the expression corresponding to the index.

    For example:

      var _ = ExpressionFactory;
    _.map(_.number(2), [_.color(red), _.color(green), _.color(blue)], _.color(black)) //returns blue
    _.map(_.number(6), [_.color(red), _.color(green), _.color(blue)], _.color(black)) //returns black

    Note that when planning to use a large number of icons in the values array, the elements should be icon expressions. Using more complex expressions in the array is possible but then the number of elements is limited. The exact number depends on computer configuration but you can assume it is close to 20.

    Type Parameters

    • T extends string | number | Vector3

    Parameters

    • indexExpression: Expression<number>

      The expression that calculates the index to use.

    • values: Expression<T>[]

      An array of value expressions.

    • defaultExpression: Expression<T>

      The expression used as default when the computed index is not valid.

    Returns Expression<T>

    An expression that maps an index onto an expression.