index.js
function stripAndSerializeComment( lineNumber, sourceStr ) {

        // Strip comment delimiter tokens
        let stripped = sourceStr
        .replace( patterns.commentBegin, '' )
        .replace( patterns.commentEnd, '' )
        .split( '\n' )
        .map( line => line.replace( rCommentLinePrefix, '' ) );

        // Determine the number of leading spaces to strip
        const prefixSpaces = stripped.reduce( function ( accum, line ) {

            if ( !accum.length && line.match( /\s*\S|\n/ ) ) {
                accum = line.match( /\s*/ )[0];
            }

            return accum;
        });

        // Strip leading spaces
        stripped = stripped.map( line => line.replace( prefixSpaces, '' ) );

        // Get line number for first tag
        const firstTagLineNumber = stripped.reduce( function ( accum, line, index ) {

            if ( isNaN( accum ) && line.match( rTagName ) ) {
                accum = index;
            }

            return accum;

        }, undefined );

        const comment = stripped.join( '\n' ).trim();
        const tags = stripped.splice( firstTagLineNumber ).join( '\n' );
        const preface = stripped.join( '\n' ).trim();

        return {
            preface,
            content: comment,
            tags: serializeTags( lineNumber + firstTagLineNumber, tags )
        };
    }
function stripAndSerializeComment( lineNumber, sourceStr ) {

        // Strip comment delimiter tokens
        let stripped = sourceStr
        .replace( patterns.commentBegin, '' )
        .replace( patterns.commentEnd, '' )
        .split( '\n' )
        .map( line => line.replace( rCommentLinePrefix, '' ) );

        // Determine the number of leading spaces to strip
        const prefixSpaces = stripped.reduce( function ( accum, line ) {

            if ( !accum.length && line.match( /\s*\S|\n/ ) ) {
                accum = line.match( /\s*/ )[0];
            }

            return accum;
        });

        // Strip leading spaces
        stripped = stripped.map( line => line.replace( prefixSpaces, '' ) );

        // Get line number for first tag
        const firstTagLineNumber = stripped.reduce( function ( accum, line, index ) {

            if ( isNaN( accum ) && line.match( rTagName ) ) {
                accum = index;
            }

            return accum;

        }, undefined );

        const comment = stripped.join( '\n' ).trim();
        const tags = stripped.splice( firstTagLineNumber ).join( '\n' );
        const preface = stripped.join( '\n' ).trim();

        return {
            preface,
            content: comment,
            tags: serializeTags( lineNumber + firstTagLineNumber, tags )
        };
    }
function stripAndSerializeComment ( lineNumber , sourceStr ) { // Strip comment delimiter tokens let stripped = sourceStr . replace ( patterns . commentBegin , '' ) . replace ( patterns . commentEnd , '' ) . split ( '\n' ) . map ( line => line . replace ( rCommentLinePrefix , '' ) ) ; // Determine the number of leading spaces to strip const prefixSpaces = stripped . reduce ( function ( accum , line ) { if ( ! accum . length && line . match ( / \s*\S|\n / ) ) { accum = line . match ( / \s* / ) [ 0 ] ; } return accum ; } ) ; // Strip leading spaces stripped = stripped . map ( line => line . replace ( prefixSpaces , '' ) ) ; // Get line number for first tag const firstTagLineNumber = stripped . reduce ( function ( accum , line , index ) { if ( isNaN ( accum ) && line . match ( rTagName ) ) { accum = index ; } return accum ; } , undefined ) ; const comment = stripped . join ( '\n' ) . trim ( ) ; const tags = stripped . splice ( firstTagLineNumber ) . join ( '\n' ) ; const preface = stripped . join ( '\n' ) . trim ( ) ; return { preface , content : comment , tags : serializeTags ( lineNumber + firstTagLineNumber , tags ) } ; }
Strip and serialize a comment into its various parts.

- comment: the comment block stripped delimiters and leading spaces.
- preface
- tags

@param {Number} lineNumber The comment's starting line number.
@param {String} sourceStr The comment's source.
@returns {Object}
Strip and serialize a comment into its various parts .