How to use the @react-native-firebase/app/lib/common.isBoolean function in @react-native-firebase/app

To help you get started, we’ve selected a few @react-native-firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github invertase / react-native-firebase / packages / firestore / lib / utils / serialize.js View on Github external
return getTypeMapInt('-infinity');
  }

  if (value === Number.POSITIVE_INFINITY) {
    return getTypeMapInt('infinity');
  }

  if (isNull(value) || isUndefined(value)) {
    return getTypeMapInt('null');
  }

  if (value === DOCUMENT_ID) {
    return getTypeMapInt('documentid');
  }

  if (isBoolean(value)) {
    if (value === true) {
      return getTypeMapInt('booleanTrue');
    }
    return getTypeMapInt('booleanFalse');
  }

  if (isNumber(value)) {
    return getTypeMapInt('number', value);
  }

  if (isString(value)) {
    if (value === '') {
      return getTypeMapInt('stringEmpty');
    }
    return getTypeMapInt('string', value);
  }
github invertase / react-native-firebase / packages / crashlytics / lib / index.js View on Github external
setCrashlyticsCollectionEnabled(enabled) {
    if (!isBoolean(enabled)) {
      throw new Error(
        "firebase.crashlytics().setCrashlyticsCollectionEnabled(*) 'enabled' must be a boolean.",
      );
    }

    this._isCrashlyticsCollectionEnabled = enabled;
    return this.native.setCrashlyticsCollectionEnabled(enabled);
  }
}
github invertase / react-native-firebase / packages / database / lib / DatabaseQuery.js View on Github external
keepSynced(bool) {
    if (!isBoolean(bool)) {
      throw new Error(
        "firebase.database().ref().keepSynced(*) 'bool' value must be a boolean value.",
      );
    }

    return this._database.native.keepSynced(
      this._generateQueryKey(),
      this.path,
      this._modifiers.toArray(),
      bool,
    );
  }
github invertase / react-native-firebase / packages / admob / lib / validateAdShowOptions.js View on Github external
export default function validateAdShowOptions(options) {
  const out = {};

  if (isUndefined(options)) {
    return out;
  }

  if (!isObject(options)) {
    throw new Error("'options' expected an object value");
  }

  if (hasOwnProperty(options, 'immersiveModeEnabled')) {
    if (!isBoolean(options.immersiveModeEnabled)) {
      throw new Error("'options.immersiveModeEnabled' expected a boolean value");
    }

    out.immersiveModeEnabled = options.immersiveModeEnabled;
  }

  return out;
}
github invertase / react-native-firebase / packages / firestore / lib / index.js View on Github external
}

      if (settings.host === '') {
        throw new Error(
          "firebase.firestore().settings(*) 'settings.host' must not be an empty string.",
        );
      }
    }

    if (!isUndefined(settings.persistence) && !isBoolean(settings.persistence)) {
      throw new Error(
        "firebase.firestore().settings(*) 'settings.persistence' must be a boolean value.",
      );
    }

    if (!isUndefined(settings.ssl) && !isBoolean(settings.ssl)) {
      throw new Error("firebase.firestore().settings(*) 'settings.ssl' must be a boolean value.");
    }

    return this.native.settings(settings);
  }
}
github invertase / react-native-firebase / packages / admob / lib / validateAdRequestOptions.js View on Github external
export default function validateAdRequestOptions(options) {
  const out = {};

  if (isUndefined(options)) {
    return out;
  }

  if (!isObject(options)) {
    throw new Error("'options' expected an object value");
  }

  if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {
    if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {
      throw new Error("'options.requestNonPersonalizedAdsOnly' expected a boolean value");
    }

    out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;
  }

  if (options.networkExtras) {
    if (!isObject(options.networkExtras)) {
      throw new Error("'options.networkExtras' expected an object of key/value pairs");
    }

    Object.entries(options.networkExtras).forEach(([key, value]) => {
      if (!isString(value)) {
        throw new Error(`'options.networkExtras' expected a string value for object key "${key}"`);
      }
    });
github invertase / react-native-firebase / packages / dynamic-links / lib / builders / navigation.js View on Github external
export default function buildNavigation(navigationParams) {
  if (!isObject(navigationParams)) {
    throw new Error("'dynamicLinksParams.navigation' must be an object.");
  }

  const params = {};

  if (hasOwnProperty(navigationParams, 'forcedRedirectEnabled')) {
    if (!isBoolean(navigationParams.forcedRedirectEnabled)) {
      throw new Error("'dynamicLinksParams.navigation.forcedRedirectEnabled' must be a boolean.");
    }

    params.forcedRedirectEnabled = navigationParams.forcedRedirectEnabled;
  }

  return params;
}
github invertase / react-native-firebase / packages / firestore / lib / utils / index.js View on Github external
const out = {};

  if (isUndefined(options)) {
    return out;
  }

  if (!isObject(options)) {
    throw new Error("'options' must be an object.");
  }

  if (hasOwnProperty(options, 'merge') && hasOwnProperty(options, 'mergeFields')) {
    throw new Error("'options' must not contain both 'merge' & 'mergeFields'.");
  }

  if (!isUndefined(options.merge)) {
    if (!isBoolean(options.merge)) {
      throw new Error("'options.merge' must be a boolean value.");
    }

    out.merge = true;
  }

  if (!isUndefined(options.mergeFields)) {
    if (!isArray(options.mergeFields)) {
      throw new Error("'options.mergeFields' must be an array.");
    }

    out.mergeFields = [];

    for (let i = 0; i < options.mergeFields.length; i++) {
      const field = options.mergeFields[i];
      if (!isString(field) && !(field instanceof FirestoreFieldPath)) {
github invertase / react-native-firebase / packages / admob / lib / validateAdRequestConfiguration.js View on Github external
if (
      requestConfiguration.maxAdContentRating !== MaxAdContentRating.G &&
      requestConfiguration.maxAdContentRating !== MaxAdContentRating.PG &&
      requestConfiguration.maxAdContentRating !== MaxAdContentRating.T &&
      requestConfiguration.maxAdContentRating !== MaxAdContentRating.MA
    ) {
      throw new Error(
        "'requestConfiguration.maxAdContentRating' expected on of MaxAdContentRating.G, MaxAdContentRating.PG, MaxAdContentRating.T or MaxAdContentRating.MA",
      );
    }

    out.maxAdContentRating = requestConfiguration.maxAdContentRating;
  }

  if (hasOwnProperty(requestConfiguration, 'tagForChildDirectedTreatment')) {
    if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {
      throw new Error(
        "'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value",
      );
    }

    out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
  }

  if (hasOwnProperty(requestConfiguration, 'tagForUnderAgeOfConsent')) {
    if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {
      throw new Error("'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value");
    }

    out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
  }

@react-native-firebase/app

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

Apache-2.0
Latest version published 1 day ago

Package Health Score

98 / 100
Full package analysis