index.js
function serializeTags( lineNumber, tags ) {

        return tags.split( /\n/ )
        .reduce( function ( acc, line, index ) {

            if ( !index || rTagName.test( line ) ) {
                acc.push( `${line}\n` );
            }
            else {
                acc[ acc.length - 1 ] += `${line}\n`;
            }

            return acc;

        }, [] )
        .map( function ( block ) {

            const trimmed = block.trim();
            const tag = block.match( rTagName )[0];

            const result = {
                line: lineNumber,
                tag: tag.replace( patterns.tagPrefix, '' ),
                value: trimmed.replace( tag, '' ).replace( rLeadSpaces, '' ),
                valueParsed: [],
                source: trimmed
            };

            lineNumber = lineNumber + getLinesLength( block );

            return result;
        })
        .map( function ( tag ) {

            const parser = parsers[ tag.tag ];

            if ( parser ) {

                try {

                    tag.valueParsed = parser( tag.value );
                }
                catch ( err ) {

                    tag.error = err;
                }
            }

            return tag;
        });
    }
function serializeTags( lineNumber, tags ) {

        return tags.split( /\n/ )
        .reduce( function ( acc, line, index ) {

            if ( !index || rTagName.test( line ) ) {
                acc.push( `${line}\n` );
            }
            else {
                acc[ acc.length - 1 ] += `${line}\n`;
            }

            return acc;

        }, [] )
        .map( function ( block ) {

            const trimmed = block.trim();
            const tag = block.match( rTagName )[0];

            const result = {
                line: lineNumber,
                tag: tag.replace( patterns.tagPrefix, '' ),
                value: trimmed.replace( tag, '' ).replace( rLeadSpaces, '' ),
                valueParsed: [],
                source: trimmed
            };

            lineNumber = lineNumber + getLinesLength( block );

            return result;
        })
        .map( function ( tag ) {

            const parser = parsers[ tag.tag ];

            if ( parser ) {

                try {

                    tag.valueParsed = parser( tag.value );
                }
                catch ( err ) {

                    tag.error = err;
                }
            }

            return tag;
        });
    }
function serializeTags ( lineNumber , tags ) { return tags . split ( / \n / ) . reduce ( function ( acc , line , index ) { if ( ! index || rTagName . test ( line ) ) { acc . push ( ` ${ line } \n ` ) ; } else { acc [ acc . length - 1 ] += ` ${ line } \n ` ; } return acc ; } , [ ] ) . map ( function ( block ) { const trimmed = block . trim ( ) ; const tag = block . match ( rTagName ) [ 0 ] ; const result = { line : lineNumber , tag : tag . replace ( patterns . tagPrefix , '' ) , value : trimmed . replace ( tag , '' ) . replace ( rLeadSpaces , '' ) , valueParsed : [ ] , source : trimmed } ; lineNumber = lineNumber + getLinesLength ( block ) ; return result ; } ) . map ( function ( tag ) { const parser = parsers [ tag . tag ] ; if ( parser ) { try { tag . valueParsed = parser ( tag . value ) ; } catch ( err ) { tag . error = err ; } } return tag ; } ) ; }
Takes a tags block and serializes it into individual tag objects.

@param {Number} lineNumber The tags block starting line number.
@param {String} tags The tags block.
@returns {Array}
Takes a tags block and serializes it into individual tag objects .