How to use the @react-native-firebase/common.isNumber function in @react-native-firebase/common

To help you get started, we’ve selected a few @react-native-firebase/common 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 / ml-natural-language / lib / SmartReplyConversation.js View on Github external
addRemoteUserMessage(text, timestamp, remoteUserId) {
    if (!isString(text)) {
      throw new Error(
        "firebase.naturalLanguage.SmartReplyConversation.addRemoteUserMessage(*, _, _) 'text' must be a string value.",
      );
    }

    if (!isNumber(timestamp)) {
      throw new Error(
        "firebase.naturalLanguage.SmartReplyConversation.addRemoteUserMessage(_, *, _) 'timestamp' must be a number value.",
      );
    }

    if (!isString(remoteUserId)) {
      throw new Error(
        "firebase.naturalLanguage.SmartReplyConversation.addRemoteUserMessage(_, _, *) 'remoteUserId' must be a string value.",
      );
    }

    this.messages.push({ text, timestamp: timestamp || Date.now(), remoteUserId });
    if (this.messages.length > this.messageHistoryLimit) {
      this.messages = this.messages.slice(-this.messageHistoryLimit);
    }
  }