code: function newNestedIndex(vectors) {
    var arity = vectors.length;
    if (arity === 0) {
      throw new Error('cannot index an empty list of vectors');
    }
    var numRows = vectors[0].size();
  
    // Initialize properties
    var nestedIndex = Object.create(nestedIndexProto);
    nestedIndex.initVectors = vectors;
    nestedIndex.size = 0;
    nestedIndex.arity = arity;
    nestedIndex._dtypes = vectors.map(function(v) { return v.dtype; });
    nestedIndex._map = Object.create(null);
  
    // Build index
    var rootMap = nestedIndex._map;
    var lastColInd = arity - 1;
    for (var i = 0; i < numRows; i++) {
      var currMap = rootMap;
      var currVector, key;
      for (var j = 0; j < lastColInd; j++) {
        currVector = vectors[j];
        key = cleanKey(currVector.values[i], currVector.dtype);
        var innerMap = currMap[key];
  
        // Create innerMap if not present
        if (isUndefined(innerMap)) {
          currMap[key] = innerMap = Object.create(null);
        }
        currMap = innerMap;
      }
  
      // Add the row number to the entry
      currVector = vectors[lastColInd];
      key = cleanKey(currVector.values[i], currVector.dtype);
      var rowNums = currMap[key];
      if (isUndefined(rowNums)) {
        currMap[key] = i;
        nestedIndex.size++;
      } else if (typeof rowNums === 'number') {
        currMap[key] = [rowNums, i];
      } else {
        // rowNums must be an array
        rowNums.push(i);
      }
    }
  
    return nestedIndex;
  }
docs: Creates a new NestedIndex for the given 'vectors' array (which may contain a single element to index a single vector).