all files / addon/helpers/ autolink.js

100% Statements 3/3
100% Branches 2/2
100% Functions 1/1
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16          1×   1× 8×              
import Autolinker from 'autolinker'
import { helper } from '@ember/component/helper'
import { htmlSafe } from '@ember/string'
import Ember from 'ember'
 
const { Handlebars: { Utils: { escapeExpression } } } = Ember
 
export function autolink([text, disableHtmlSafety]) {
  return htmlSafe(
    Autolinker.link(disableHtmlSafety ? text : escapeExpression(text))
  )
}
 
export default helper(autolink)