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.

slice-chunks.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict'
  2. var assert = require('assert')
  3. function _interopDefaultLegacy(e) {
  4. return e && typeof e === 'object' && 'default' in e ? e : {default: e}
  5. }
  6. var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert)
  7. function sliceChunks(chunks, token) {
  8. var startIndex = token.start._index
  9. var startBufferIndex = token.start._bufferIndex
  10. var endIndex = token.end._index
  11. var endBufferIndex = token.end._bufferIndex
  12. var view
  13. if (startIndex === endIndex) {
  14. assert__default['default'](
  15. endBufferIndex > -1,
  16. 'expected non-negative end buffer index'
  17. )
  18. assert__default['default'](
  19. startBufferIndex > -1,
  20. 'expected non-negative start buffer index'
  21. )
  22. view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]
  23. } else {
  24. view = chunks.slice(startIndex, endIndex)
  25. if (startBufferIndex > -1) {
  26. view[0] = view[0].slice(startBufferIndex)
  27. }
  28. if (endBufferIndex > 0) {
  29. view.push(chunks[endIndex].slice(0, endBufferIndex))
  30. }
  31. }
  32. return view
  33. }
  34. module.exports = sliceChunks