Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

decode-entity.browser.js 867B

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