import { CommunicationObserver } from './CommunicationObserver' ; param source param target returns export function stringToLines ( source , target ) { let quoted = false ; let start = 0 ; let index = 0 ; while ( index < source . length ) { const c = source . charCodeAt ( index ) ; if ( c === 10 ) { if ( ! quoted ) { const end = index > 0 && source . charCodeAt ( index - 1 ) === 13 ? index - 1 : index ; target . next ( source . substring ( start , end ) ) ; start = index + 1 ; } } else if ( c === 34 ) { quoted = ! quoted ; } index ++ ; } if ( start < index ) { target . next ( source . substring ( start , index ) ) ; } target . complete ( ) ; }