react-native/local-cli/util/PackageManager.js
function callYarnOrNpm(yarnCommand, npmCommand) {
  let command;

  if (isYarnAvailable) {
    command = yarnCommand;
  } else {
    command = npmCommand;
  }

  const args = command.split(' ');
  const cmd = args.shift();

  const res = spawnSync(cmd, args, spawnOpts);

  return res;
}
function callYarnOrNpm(yarnCommand, npmCommand) {
  let command;

  if (isYarnAvailable) {
    command = yarnCommand;
  } else {
    command = npmCommand;
  }

  const args = command.split(' ');
  const cmd = args.shift();

  const res = spawnSync(cmd, args, spawnOpts);

  return res;
}
function callYarnOrNpm ( yarnCommand , npmCommand ) { let command ; if ( isYarnAvailable ) { command = yarnCommand ; } else { command = npmCommand ; } const args = command . split ( ' ' ) ; const cmd = args . shift ( ) ; const res = spawnSync ( cmd , args , spawnOpts ) ; return res ; }
Execute npm or yarn command

@param  {String} yarnCommand Yarn command to be executed eg. yarn add package
@param  {String} npmCommand  Npm command to be executed eg. npm install package
@return {object}             spawnSync's result object
Execute npm or yarn command