How to use the @react-native-firebase/app/lib/common.isUndefined 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 / FirestoreQuery.js View on Github external
_handleQueryCursor(cursor, docOrField, fields) {
    const modifiers = this._modifiers._copy();

    if (isUndefined(docOrField)) {
      throw new Error(
        `firebase.firestore().collection().${cursor}(*) Expected a DocumentSnapshot or list of field values but got undefined.`,
      );
    }

    // Handles cases where the first arg is a DocumentSnapshot
    if (docOrField instanceof FirestoreDocumentSnapshot) {
      if (fields.length > 0) {
        throw new Error(
          `firebase.firestore().collection().${cursor}(*) Too many arguments provided. Expected DocumentSnapshot or list of field values.`,
        );
      }

      const documentSnapshot = docOrField;

      if (!documentSnapshot.exists) {
github invertase / react-native-firebase / packages / messaging / lib / index.js View on Github external
deleteToken(authorizedEntity, scope) {
    if (!isUndefined(authorizedEntity) && !isString(authorizedEntity)) {
      throw new Error(
        "firebase.messaging().deleteToken(*) 'authorizedEntity' expected a string value.",
      );
    }

    if (!isUndefined(scope) && !isString(scope)) {
      throw new Error("firebase.messaging().deleteToken(_, *) 'scope' expected a string value.");
    }

    return this.native.deleteToken(
      authorizedEntity || this.app.options.messagingSenderId,
      scope || 'FCM',
    );
  }
github invertase / react-native-firebase / packages / firestore / lib / FirestoreQuerySnapshot.js View on Github external
docChanges(options) {
    if (!isUndefined(options) && !isObject(options)) {
      throw new Error(
        "firebase.firestore() QuerySnapshot.docChanges(*) 'options' expected an object.",
      );
    }

    let includeMetaDataChanges = false;

    if (options) {
      if (!isBoolean(options.includeMetadataChanges)) {
        throw new Error(
          "firebase.firestore() QuerySnapshot.docChanges(*) 'options.includeMetadataChanges' expected a boolean.",
        );
      }

      includeMetaDataChanges = options.includeMetadataChanges;
    }
github invertase / react-native-firebase / packages / storage / lib / StorageReference.js View on Github external
let _string = string;
    let _format = format;
    let _metadata = metadata;

    if (format === StorageStatics.StringFormat.RAW) {
      _string = Base64.btoa(_string);
      _format = StorageStatics.StringFormat.BASE64;
    } else if (format === StorageStatics.StringFormat.DATA_URL) {
      const { mediaType, base64String } = getDataUrlParts(_string);
      if (isUndefined(base64String)) {
        throw new Error(
          'firebase.storage.StorageReference.putString(*, _, _) invalid data_url string provided.',
        );
      }

      if (isUndefined(metadata) || isUndefined(metadata.contentType)) {
        if (isUndefined(metadata)) {
          _metadata = {};
        }
        _metadata.contentType = mediaType;
        _string = base64String;
        _format = StorageStatics.StringFormat.BASE64;
      }
    }

    return new StorageUploadTask(this, task =>
      this._storage.native.putString(this.toString(), _string, _format, _metadata, task._id),
    );
  }
github invertase / react-native-firebase / packages / admob / lib / AdsConsent.js View on Github external
showForm(options) {
    if (!isUndefined(options) && !isObject(options)) {
      throw new Error("firebase.admob.AdsConsent.showForm(*) 'options' expected an object value.");
    }

    if (!isValidUrl(options.privacyPolicy)) {
      throw new Error(
        "firebase.admob.AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.",
      );
    }

    if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {
      throw new Error(
        "firebase.admob.AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.",
      );
    }

    if (
github invertase / react-native-firebase / packages / messaging / lib / remoteMessageOptions.js View on Github external
export default function remoteMessageOptions(messagingSenderId, remoteMessage) {
  const out = {};

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

  if (!remoteMessage.to) {
    out.to = `${messagingSenderId}@fcm.googleapis.com`;
  } else if (!isString(remoteMessage.to)) {
    throw new Error("'remoteMessage.to' expected a string value");
  } else {
    out.to = remoteMessage.to;
  }

  if (!remoteMessage.messageId) {
    out.messageId = generateFirestoreId();
  } else if (!isString(remoteMessage.messageId)) {
    throw new Error("'remoteMessage.messageId' expected a string value");
  } else {
github invertase / react-native-firebase / packages / database / lib / DatabaseQuery.js View on Github external
once(eventType, successCallBack, failureCallbackOrContext, context) {
    if (!eventTypes.includes(eventType)) {
      throw new Error(
        `firebase.database().ref().once(*) 'eventType' must be one of ${eventTypes.join(', ')}.`,
      );
    }

    if (!isUndefined(successCallBack) && !isFunction(successCallBack)) {
      throw new Error("firebase.database().ref().once(_, *) 'successCallBack' must be a function.");
    }

    if (
      !isUndefined(failureCallbackOrContext) &&
      (!isObject(failureCallbackOrContext) && !isFunction(failureCallbackOrContext))
    ) {
      throw new Error(
        "firebase.database().ref().once(_, _, *) 'failureCallbackOrContext' must be a function or context.",
      );
    }

    if (!isUndefined(context) && !isObject(context)) {
      throw new Error(
        "firebase.database().ref().once(_, _, _, *) 'context' must be a context object.",
      );
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
push(value, onComplete) {
    if (!isUndefined(onComplete) && !isFunction(onComplete)) {
      throw new Error(
        "firebase.database().ref().push(_, *) 'onComplete' must be a function if provided.",
      );
    }

    const id = generateDatabaseId(this._database._serverTimeOffset);

    if (isUndefined(value) || isNull(value)) {
      return new DatabaseThenableReference(
        this._database,
        pathChild(this.path, id),
        Promise.resolve(this.child(id)),
      );
    }

    const pushRef = this.child(id);
github invertase / react-native-firebase / packages / firestore / lib / FirestoreSnapshotMetadata.js View on Github external
isEqual(other) {
    if (isUndefined(other) || !(other instanceof FirestoreSnapshotMetadata)) {
      throw new Error(
        "firebase.firestore() SnapshotMetadata.isEqual(*) 'other' expected instance of SnapshotMetadata",
      );
    }

    return this.fromCache === other.fromCache && this.hasPendingWrites === other.hasPendingWrites;
  }
}

@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