jsdataframe.js
function resolveSelectorHelper(selector, opts, resultArr) {
  if (selector !== null && typeof selector === 'object') {
    if (typeof selector._resolveSelectorHelper === 'function') {
      selector._resolveSelectorHelper(opts, resultArr);
      return;
    }
    if (Array.isArray(selector)) {
      for (var i = 0; i < selector.length; i++) {
        resolveSelectorHelper(selector[i], opts, resultArr);
      }
      return;
    }
  }

  // Handle scalar case
  var intInds;
  switch (opts.resolveMode) {
    case RESOLVE_MODE.INT:
      resultArr.push(resolveIntIdx(selector, opts.maxLen));
      break;
    case RESOLVE_MODE.COL:
      if (isNumber(selector)) {
        resultArr.push(resolveIntIdx(selector, opts.maxLen));
      } else if (isString(selector) || selector === null) {
        intInds = opts.index.lookupKey([selector]);
        processLookupResults(intInds, selector, opts, resultArr);
      } else {
        throw new Error('expected integer or string selector but got: ' +
          selector);
      }
      break;
    case RESOLVE_MODE.KEY:
      if (opts.index.arity === 1) {
        var expectedDtype = opts.index.initVectors[0].dtype;
        validateScalarIsDtype(selector, expectedDtype);
        intInds = opts.index.lookupKey([selector]);
        processLookupResults(intInds, selector, opts, resultArr);
      } else {
        // TODO
        throw new Error('unimplemented case (TODO)');
      }
      break;
    default:
      throw new Error('Unrecognized RESOLVE_MODE: ' + opts.resolveMode);
  }
}
function resolveSelectorHelper(selector, opts, resultArr) {
  if (selector !== null && typeof selector === 'object') {
    if (typeof selector._resolveSelectorHelper === 'function') {
      selector._resolveSelectorHelper(opts, resultArr);
      return;
    }
    if (Array.isArray(selector)) {
      for (var i = 0; i < selector.length; i++) {
        resolveSelectorHelper(selector[i], opts, resultArr);
      }
      return;
    }
  }

  // Handle scalar case
  var intInds;
  switch (opts.resolveMode) {
    case RESOLVE_MODE.INT:
      resultArr.push(resolveIntIdx(selector, opts.maxLen));
      break;
    case RESOLVE_MODE.COL:
      if (isNumber(selector)) {
        resultArr.push(resolveIntIdx(selector, opts.maxLen));
      } else if (isString(selector) || selector === null) {
        intInds = opts.index.lookupKey([selector]);
        processLookupResults(intInds, selector, opts, resultArr);
      } else {
        throw new Error('expected integer or string selector but got: ' +
          selector);
      }
      break;
    case RESOLVE_MODE.KEY:
      if (opts.index.arity === 1) {
        var expectedDtype = opts.index.initVectors[0].dtype;
        validateScalarIsDtype(selector, expectedDtype);
        intInds = opts.index.lookupKey([selector]);
        processLookupResults(intInds, selector, opts, resultArr);
      } else {
        // TODO
        throw new Error('unimplemented case (TODO)');
      }
      break;
    default:
      throw new Error('Unrecognized RESOLVE_MODE: ' + opts.resolveMode);
  }
}
function resolveSelectorHelper ( selector , opts , resultArr ) { if ( selector !== null && typeof selector === 'object' ) { if ( typeof selector . _resolveSelectorHelper === 'function' ) { selector . _resolveSelectorHelper ( opts , resultArr ) ; return ; } if ( Array . isArray ( selector ) ) { for ( var i = 0 ; i < selector . length ; i ++ ) { resolveSelectorHelper ( selector [ i ] , opts , resultArr ) ; } return ; } } // Handle scalar case var intInds ; switch ( opts . resolveMode ) { case RESOLVE_MODE . INT : resultArr . push ( resolveIntIdx ( selector , opts . maxLen ) ) ; break ; case RESOLVE_MODE . COL : if ( isNumber ( selector ) ) { resultArr . push ( resolveIntIdx ( selector , opts . maxLen ) ) ; } else if ( isString ( selector ) || selector === null ) { intInds = opts . index . lookupKey ( [ selector ] ) ; processLookupResults ( intInds , selector , opts , resultArr ) ; } else { throw new Error ( 'expected integer or string selector but got: ' + selector ) ; } break ; case RESOLVE_MODE . KEY : if ( opts . index . arity === 1 ) { var expectedDtype = opts . index . initVectors [ 0 ] . dtype ; validateScalarIsDtype ( selector , expectedDtype ) ; intInds = opts . index . lookupKey ( [ selector ] ) ; processLookupResults ( intInds , selector , opts , resultArr ) ; } else { // TODO throw new Error ( 'unimplemented case (TODO)' ) ; } break ; default : throw new Error ( 'Unrecognized RESOLVE_MODE: ' + opts . resolveMode ) ; } }
Recursive helper that updates running results in 'resultArr'
Recursive helper that updates running results in resultArr