code: function normalizeFgArgs(fgArgs) {
    var program, args, cb;
    var processArgsEnd = fgArgs.length;
    var lastFgArg = fgArgs[fgArgs.length - 1];
    if (typeof lastFgArg === "function") {
      cb = lastFgArg;
      processArgsEnd -= 1;
    } else {
      cb = function(done) { done(); };
    }
  
    if (Array.isArray(fgArgs[0])) {
      program = fgArgs[0][0];
      args = fgArgs[0].slice(1);
    } else {
      program = fgArgs[0];
      args = Array.isArray(fgArgs[1]) ? fgArgs[1] : fgArgs.slice(1, processArgsEnd);
    }
  
    return {program: program, args: args, cb: cb};
  }
docs: Normalizes the arguments passed to `foregroundChild`.
  
  See the signature of `foregroundChild` for the supported arguments.
  
  @param fgArgs Array of arguments passed to `foregroundChild`.
  @return Normalized arguments
  @internal