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.

serialize-chunks.js 799B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict'
  2. var fromCharCode = require('../constant/from-char-code.js')
  3. function serializeChunks(chunks) {
  4. var index = -1
  5. var result = []
  6. var chunk
  7. var value
  8. var atTab
  9. while (++index < chunks.length) {
  10. chunk = chunks[index]
  11. if (typeof chunk === 'string') {
  12. value = chunk
  13. } else if (chunk === -5) {
  14. value = '\r'
  15. } else if (chunk === -4) {
  16. value = '\n'
  17. } else if (chunk === -3) {
  18. value = '\r' + '\n'
  19. } else if (chunk === -2) {
  20. value = '\t'
  21. } else if (chunk === -1) {
  22. if (atTab) continue
  23. value = ' '
  24. } else {
  25. // Currently only replacement character.
  26. value = fromCharCode(chunk)
  27. }
  28. atTab = chunk === -2
  29. result.push(value)
  30. }
  31. return result.join('')
  32. }
  33. module.exports = serializeChunks