All files / src lines.ts

88.88% Statements 8/9
100% Branches 2/2
100% Functions 1/1
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1822x               22x 5x 5x 2x   3x     22x  
import maybeLines from './maybe-lines.js'
import type S from './sanitised.js'
 
/**
 * @returns lines joined with provided separator.
 * @throws if there are no lines on output.
 */
export const lines =
  <T>(inputs: readonly T[], separator = '\n'): S => {
    const output = maybeLines(inputs, separator)
    if (typeof output === 'undefined') {
      throw new Error('Expected at least one line.')
    }
    return output
  }
 
export default lines