3 /* eslint-env browser */
7 var semicolon = 59 // ';'
9 module.exports = decodeEntity
11 function decodeEntity(characters) {
12 var entity = '&' + characters + ';'
15 el = el || document.createElement('i')
19 // Some entities do not require the closing semicolon (`¬` - for instance),
20 // which leads to situations where parsing the assumed entity of ¬it; will
21 // result in the string `¬it;`. When we encounter a trailing semicolon after
22 // parsing and the entity to decode was not a semicolon (`;`), we can
23 // assume that the matching was incomplete
24 if (char.charCodeAt(char.length - 1) === semicolon && characters !== 'semi') {
28 // If the decoded string is equal to the input, the entity was not valid
29 return char === entity ? false : char