How to use the @react-native-firebase/app/lib/common.isString 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 / database / lib / DatabaseDataSnapshot.js View on Github external
child(path) {
    if (!isString(path)) {
      throw new Error("snapshot().child(*) 'path' must be a string value");
    }

    let value = deepGet(this._snapshot.value, path);

    if (value === undefined) {
      value = null;
    }

    const childRef = this._ref.child(path);

    return new DatabaseDataSnapshot(childRef, {
      value,
      key: childRef.key,
      exists: value !== null,
      childKeys: isObject(value) ? Object.keys(value) : [],
github invertase / react-native-firebase / packages / ml-natural-language / lib / validateTextMessage.js View on Github external
if (hasOwnProperty(textMessage, 'isLocalUser')) {
    if (!isBoolean(textMessage.isLocalUser)) {
      throw new Error("'textMessage.isLocalUser' expected boolean value");
    }

    out.isLocalUser = textMessage.isLocalUser;
  }

  if (out.isLocalUser && hasOwnProperty(textMessage, 'userId')) {
    throw new Error(
      "'textMessage.userId' expected 'textMessage.isLocalUser' to be false when setting a user ID.",
    );
  } else if (!out.isLocalUser && !hasOwnProperty(textMessage, 'userId')) {
    throw new Error("'textMessage.userId' expected a string value");
  } else if (!out.isLocalUser && hasOwnProperty(textMessage, 'userId')) {
    if (!isString(textMessage.userId)) {
      throw new Error("'textMessage.userId' expected a string value");
    }

    if (textMessage.userId.length === 0) {
      throw new Error("'textMessage.userId' expected string value to not be empty");
    }

    out.userId = textMessage.userId;
  }

  return out;
}
github invertase / react-native-firebase / packages / storage / lib / index.js View on Github external
constructor(app, config, bucketUrl) {
    super(app, config, bucketUrl);
    if (bucketUrl === undefined) {
      this._customUrlOrRegion = `gs://${app.options.storageBucket}`;
    } else if (!isString(bucketUrl) || !bucketUrl.startsWith('gs://')) {
      throw new Error(
        "firebase.app().storage(*) bucket url must be a string and begin with 'gs://'",
      );
    }

    this.emitter.addListener(
      this.eventNameForApp(nativeEvents[0]),
      handleStorageEvent.bind(null, this),
    );

    this._maxUploadRetryTime = this.native.maxUploadRetryTime || 0;
    this._maxDownloadRetryTime = this.native.maxDownloadRetryTime || 0;
    this._maxOperationRetryTime = this.native.maxOperationRetryTime || 0;
  }
github invertase / react-native-firebase / packages / firestore / lib / FirestoreBlob.js View on Github external
static fromBase64String(base64) {
    if (!isString(base64) || base64.length < 1) {
      throw new Error(
        'firestore.Blob.fromBase64String expects a string of at least 1 character in length',
      );
    }

    return new FirestoreBlob(true, Base64.atob(base64));
  }
github invertase / react-native-firebase / packages / crashlytics / lib / index.js View on Github external
setAttribute(name, value) {
    if (!isString(name)) {
      throw new Error(
        'firebase.crashlytics().setAttribute(*, _): The supplied property name must be a string.',
      );
    }

    if (!isString(value)) {
      throw new Error(
        'firebase.crashlytics().setAttribute(_, *): The supplied property value must be a string value.',
      );
    }

    return this.native.setAttribute(name, value);
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseQuery.js View on Github external
equalTo(value, key) {
    if (!isNumber(value) && !isString(value) && !isBoolean(value) && !isNull(value)) {
      throw new Error(
        "firebase.database().ref().equalTo(*) 'value' must be a number, string, boolean or null value.",
      );
    }

    if (!isUndefined(key) && !isString(key)) {
      throw new Error(
        "firebase.database().ref().equalTo(_, *) 'key' must be a string value if defined.",
      );
    }

    if (this._modifiers.hasStartAt()) {
      throw new Error(
        'firebase.database().ref().equalTo() Starting point was already set (by another call to startAt or equalTo).',
      );
    }
github invertase / react-native-firebase / packages / admob / lib / validateAdRequestOptions.js View on Github external
throw new Error(`'options.networkExtras' expected a string value for object key "${key}"`);
      }
    });

    out.networkExtras = options.networkExtras;
  }

  if (options.keywords) {
    if (!isArray(options.keywords)) {
      throw new Error("'options.keywords' expected an array containing string values");
    }

    for (let i = 0; i < options.keywords.length; i++) {
      const keyword = options.keywords[i];

      if (!isString(keyword)) {
        throw new Error("'options.keywords' expected an array containing string values");
      }
    }

    out.keywords = options.keywords;
  }

  if (options.testDevices) {
    if (!isArray(options.testDevices)) {
      throw new Error("'options.testDevices' expected an array containing string values");
    }

    for (let i = 0; i < options.testDevices.length; i++) {
      const device = options.testDevices[i];

      if (!isString(device)) {
github invertase / react-native-firebase / packages / dynamic-links / lib / builders / ios.js View on Github external
if (!isObject(iosParams)) {
    throw new Error("'dynamicLinksParams.ios' must be an object.");
  }

  const params = {};

  if (iosParams.appStoreId) {
    if (!isString(iosParams.appStoreId)) {
      throw new Error("'dynamicLinksParams.ios.appStoreId' must be a string.");
    }

    params.appStoreId = iosParams.appStoreId;
  }

  if (iosParams.bundleId) {
    if (!isString(iosParams.bundleId)) {
      throw new Error("'dynamicLinksParams.ios.bundleId' must be a string.");
    }

    params.bundleId = iosParams.bundleId;
  }

  if (iosParams.customScheme) {
    if (!isString(iosParams.customScheme)) {
      throw new Error("'dynamicLinksParams.ios.customScheme' must be a string.");
    }

    params.customScheme = iosParams.customScheme;
  }

  if (iosParams.fallbackUrl) {
    if (!isString(iosParams.fallbackUrl)) {
github invertase / react-native-firebase / packages / firestore / lib / FirestoreQuery.js View on Github external
where(fieldPath, opStr, value) {
    if (!isString(fieldPath) && !(fieldPath instanceof FirestoreFieldPath)) {
      throw new Error(
        "firebase.firestore().collection().where(*) 'fieldPath' must be a string or instance of FieldPath.",
      );
    }

    let path;

    if (isString(fieldPath)) {
      try {
        path = fromDotSeparatedString(fieldPath);
      } catch (e) {
        throw new Error(`firebase.firestore().collection().where(*) 'fieldPath' ${e.message}.`);
      }
    } else {
      path = fieldPath;
    }

    if (!this._modifiers.isValidOperator(opStr)) {
      throw new Error(
        "firebase.firestore().collection().where(_, *) 'opStr' is invalid. Expected one of '==', '>', '>=', '<', '<=' or 'array-contains'.",
      );
    }

    if (isUndefined(value)) {

@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