Evan You
8 years ago
3 changed files with 18 additions and 16 deletions
@ -1,8 +1,18 @@ |
|||
/* @flow */ |
|||
|
|||
const decoder = document.createElement('div') |
|||
import { inBrowser } from 'core/util/env' |
|||
|
|||
export function decode (html: string): string { |
|||
decoder.innerHTML = html |
|||
return decoder.textContent |
|||
let decode |
|||
|
|||
/* istanbul ignore else */ |
|||
if (inBrowser) { |
|||
const decoder = document.createElement('div') |
|||
decode = (html: string): string => { |
|||
decoder.innerHTML = html |
|||
return decoder.textContent |
|||
} |
|||
} else { |
|||
decode = require('he').decode |
|||
} |
|||
|
|||
export { decode } |
|||
|
Loading…
Reference in new issue