code: function(dest, indexMap) {
        var newIndex;
        return dest.replace(/\[[^\]]*\]/g, function(arrayNotation) {
          if (arrayNotation.match(/\[\d+\]/g) || arrayNotation.match(/\[\]/g)) {
            return arrayNotation;
          } else {
            newIndex = indexMap[arrayNotation.substring(1, arrayNotation.length - 1)];
            if (_.isString(newIndex)) {
              return '.' + newIndex;
            } else {
              return '[' + (newIndex === undefined ? '' : newIndex) + ']';
            }
          }
        });
      }
docs: Takes a map from variable name to value to be replaced and processes a string with them.
  Example: foo.bar[x].baz[0][1].taz[y] and {x: 5, y: 9} will return as foo.bar[5].baz[0][1].taz[9]
  Also supports objects:
  Example: foo.bar and {bar: someString} will return as foo.someString
  @private
  @method __substituteIndicesUsingMap