Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const message = props.message
const isSelf = message.senderId === accountId
const date = message.createdDate
if (message.mediaUrls.length > 0) {
console.log('has media urls', message)
return (
<div data-ismedia="true" data-isself="{isSelf}">
{message.mediaUrls.map((url, index) => )}
<div>{date.toLocaleTimeString()}</div>
</div>
)
}
const text = Html5Entities.decode(message.text)
const segmenter = new Segmenter(text.length, { style: 'normal' })
const linkPattern = /https?:\/\/t\.co\/[^\s]*/g
for (const match of text.matchAll(linkPattern)) {
segmenter.setSpan(match.index, match.index + match[0].length - 1, {
style: 'link',
href: match[0],
})
}
const segments = segmenter.array.map(({ start, end, value }, index) => {
const slice = text.slice(start, end+1)
switch (value.style) {
case 'normal':
return <span>{slice}</span>
case 'link':
break;
case this.TYPES.PICK:
transformedResult = _.pick(result, step.prop);
break;
case this.TYPES.GET:
transformedResult = _.get(result, step.path, step.default);
break;
case this.TYPES.DECODE_URL:
transformedResult = decodeURI(result);
break;
case this.TYPES.DECODE_HTML:
return entities.decode(result);
break;
case this.TYPES.COMBINE:
const fields = step.fields || [];
const type = step.dataType || 'string';
const resultValue = [];
_.each(fields, field => {
let value = this._storage.get(field);
switch (type) {
case 'int':
value = parseInt(value);
break;
case 'number':
value = parseFloat(value);
break;
}
doTransform() {
return entities.decode(this._value);
}
}