lib/helper/Appium.js
function onlyForApps(expectedPlatform) {
  const stack = new Error().stack || '';
  const re = /Appium.(\w+)/g;
  const caller = stack.split('\n')[2].trim();
  const m = re.exec(caller);

  if (!m) {
    throw new Error(`Invalid caller ${caller}`);
  }

  const callerName = m[1] || m[2];
  if (!expectedPlatform) {
    if (!this.platform) {
      throw new Error(`${callerName} method can be used only with apps`);
    }
  } else if (this.platform !== expectedPlatform.toLowerCase()) {
    throw new Error(`${callerName} method can be used only with ${expectedPlatform} apps`);
  }
}
function onlyForApps(expectedPlatform) {
  const stack = new Error().stack || '';
  const re = /Appium.(\w+)/g;
  const caller = stack.split('\n')[2].trim();
  const m = re.exec(caller);

  if (!m) {
    throw new Error(`Invalid caller ${caller}`);
  }

  const callerName = m[1] || m[2];
  if (!expectedPlatform) {
    if (!this.platform) {
      throw new Error(`${callerName} method can be used only with apps`);
    }
  } else if (this.platform !== expectedPlatform.toLowerCase()) {
    throw new Error(`${callerName} method can be used only with ${expectedPlatform} apps`);
  }
}
function onlyForApps ( expectedPlatform ) { const stack = new Error ( ) . stack || '' ; const re = / Appium.(\w+) / g ; const caller = stack . split ( '\n' ) [ 2 ] . trim ( ) ; const m = re . exec ( caller ) ; if ( ! m ) { throw new Error ( ` ${ caller } ` ) ; } const callerName = m [ 1 ] || m [ 2 ] ; if ( ! expectedPlatform ) { if ( ! this . platform ) { throw new Error ( ` ${ callerName } ` ) ; } } else if ( this . platform !== expectedPlatform . toLowerCase ( ) ) { throw new Error ( ` ${ callerName } ${ expectedPlatform } ` ) ; } }
in the end of a file
in the end of a file