Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function transformText(text) {
const sanitized = text.slice(0, 250).replace(/[\r\n\t]/, '')
const entities = twitterText.extractEntitiesWithIndices(sanitized, {
extractUrlsWithoutProtocol: true,
})
const linkified = twitterText.autoLinkEntities(sanitized, entities, {
htmlEscapeNonEntities: true,
targetBlank: true,
usernameIncludeSymbol: true,
})
return linkified
}