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.mjs 794B

1234567891011121314151617181920212223242526272829
  1. export default sliceChunks
  2. import assert from 'assert'
  3. function sliceChunks(chunks, token) {
  4. var startIndex = token.start._index
  5. var startBufferIndex = token.start._bufferIndex
  6. var endIndex = token.end._index
  7. var endBufferIndex = token.end._bufferIndex
  8. var view
  9. if (startIndex === endIndex) {
  10. assert(endBufferIndex > -1, 'expected non-negative end buffer index')
  11. assert(startBufferIndex > -1, 'expected non-negative start buffer index')
  12. view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]
  13. } else {
  14. view = chunks.slice(startIndex, endIndex)
  15. if (startBufferIndex > -1) {
  16. view[0] = view[0].slice(startBufferIndex)
  17. }
  18. if (endBufferIndex > 0) {
  19. view.push(chunks[endIndex].slice(0, endBufferIndex))
  20. }
  21. }
  22. return view
  23. }