Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
created: function () {
if (!isAnchorLink(this.href) && isRelativeUrl(this.href)) {
this.isNuxtLink = this.rplOptions.nuxt
}
// Set link target for non nuxt-links
if (this.target.length === 0) {
if (isExternalUrl(this.href, this.rplOptions.hostname)) {
this.linkTarget = '_blank'
}
} else {
this.linkTarget = this.target
}
}
}
return this.getAnchorHeadings(html).reduce((result, item) => {
// Ignore empty headings.
if (this.textExists(item.text)) {
result.push({
text: item.text,
url: '#' + getAnchorLinkName(item.text)
})
}
return result
}, [])
},
nameDecoded: function () {
// TODO: This is a temporary fix.
// In Markup component, We can't avoid taking HTML encoded link text from CMS and feeding them into the text icon.
// We may just change all link text to HTML to solve this issue eventally.
return decodeSpecialCharacters(this.name)
},
icon () {
textDecoded: function () {
// TODO: This is a temporary fix.
// In Markup component, We can't avoid taking HTML encoded link text(especially for `"`) from CMS and feeding them into the text icon.
// We may just change all link text to HTML to solve this issue eventally.
return decodeSpecialCharacters(this.text)
},
iconSymbolFinal () {
created: function () {
if (!isAnchorLink(this.href) && isRelativeUrl(this.href)) {
this.isNuxtLink = this.rplOptions.nuxt
}
// Set link target for non nuxt-links
if (this.target.length === 0) {
if (isExternalUrl(this.href, this.rplOptions.hostname)) {
this.linkTarget = '_blank'
}
} else {
this.linkTarget = this.target
}
}
}
calcFunding (from, to) {
if (from > 0 && to > 0) {
if (from === to) {
return formatMoney(from)
} else {
return `${formatMoney(from)} - ${formatMoney(to)}`
}
} else if (from === 0 && to > 0) {
return `$0 - ${formatMoney(to)}`
} else if (from > 0 && to === 0) {
return formatMoney(from)
} else {
return null
}
},
calcStatus (startDate, endDate, terms = this.statusTerms) {
calcFunding (from, to) {
if (from > 0 && to > 0) {
if (from === to) {
return formatMoney(from)
} else {
return `${formatMoney(from)} - ${formatMoney(to)}`
}
} else if (from === 0 && to > 0) {
return `$0 - ${formatMoney(to)}`
} else if (from > 0 && to === 0) {
return formatMoney(from)
} else {
return null
}
},
calcStatus (startDate, endDate, terms = this.statusTerms) {
const calcFunding = (funding) => {
if (funding.from > 0 && funding.to > 0) {
if (funding.from === funding.to) {
return formatMoney(funding.from)
} else {
return `${formatMoney(funding.from)} - ${formatMoney(funding.to)}`
}
} else if (funding.from === 0 && funding.to > 0) {
return `$0 - ${formatMoney(funding.to)}`
} else if (funding.from > 0 && funding.to === 0) {
return formatMoney(funding.from)
} else {
return null
}
}
const fundingLevel = calcFunding(this.funding)
const calcFunding = (funding) => {
if (funding.from > 0 && funding.to > 0) {
if (funding.from === funding.to) {
return formatMoney(funding.from)
} else {
return `${formatMoney(funding.from)} - ${formatMoney(funding.to)}`
}
} else if (funding.from === 0 && funding.to > 0) {
return `$0 - ${formatMoney(funding.to)}`
} else if (funding.from > 0 && funding.to === 0) {
return formatMoney(funding.from)
} else {
return null
}
}
const fundingLevel = calcFunding(this.funding)
calcFunding (from, to) {
if (from > 0 && to > 0) {
if (from === to) {
return formatMoney(from)
} else {
return `${formatMoney(from)} - ${formatMoney(to)}`
}
} else if (from === 0 && to > 0) {
return `$0 - ${formatMoney(to)}`
} else if (from > 0 && to === 0) {
return formatMoney(from)
} else {
return null
}
},
calcStatus (startDate, endDate, terms = this.statusTerms) {