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