Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (type === "Note") {
return [new Message.Text(content, keyboard), message];
} else if (type === "Image" || type === "Video") {
const url = R.path(["object", "url"], message);
const preview = R.path(["object", "preview"], message);
if (type === "Image") {
return [new Message.Picture(url, content, preview, keyboard), message];
} else {
return [new Message.Video(url, null, preview, null, keyboard), message];
}
} else if (type === "Place") {
const latitude = R.path(["object", "latitude"], message);
const longitude = R.path(["object", "longitude"], message);
return [new Message.Location(latitude, longitude, keyboard), message];
}
return [null, message];
})
.spread((messageBuilder: any, message: any) => {
if (dataType === 'Note') {
return [new Message.Text(content, keyboard), message];
} else if (dataType === 'Image' || dataType === 'Video') {
const url = R.path(['object', 'url'], message);
const preview = R.path(['object', 'preview'], message);
if (dataType === 'Image') {
return [new Message.Picture(url, content, preview, keyboard), message];
} else {
return [new Message.Video(url, null, preview, null, keyboard), message];
}
} else if (dataType === 'Place') {
const latitude = R.path(['object', 'latitude'], message);
const longitude = R.path(['object', 'longitude'], message);
return [new Message.Location(latitude, longitude, keyboard), message];
}
return [null, message];
})
.spread((messageBuilder: any, message: any) => {
if (type === "Note") {
return [new Message.Text(content, keyboard), message];
} else if (type === "Image" || type === "Video") {
const url = R.path(["object", "url"], message);
const preview = R.path(["object", "preview"], message);
if (type === "Image") {
return [new Message.Picture(url, content, preview, keyboard), message];
} else {
return [new Message.Video(url, null, preview, null, keyboard), message];
}
} else if (type === "Place") {
const latitude = R.path(["object", "latitude"], message);
const longitude = R.path(["object", "longitude"], message);
return [new Message.Location(latitude, longitude, keyboard), message];
}
return [null, message];
})
.spread((messageBuilder: any, message: any) => {