Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}