size-chunks.js 310 B

12345678910111213141516
  1. 'use strict'
  2. // Counts tabs based on their expanded size, and CR+LF as one character.
  3. function sizeChunks(chunks) {
  4. var index = -1
  5. var size = 0
  6. while (++index < chunks.length) {
  7. size += typeof chunks[index] === 'string' ? chunks[index].length : 1
  8. }
  9. return size
  10. }
  11. module.exports = sizeChunks