How to use the @react-native-firebase/common.isUndefined 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
addLocalUserMessage(text, timestamp) {
    if (!isString(text)) {
      throw new Error(
        "firebase.naturalLanguage.SmartReplyConversation.addRemoteUserMessage(*, _, _) 'text' must be a string value.",
      );
    }

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

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