lib/bodystructure.js
function createBodystructure(tree, options) {
    options = options || {};

    var walker = function(node) {
        switch((node.parsedHeader['content-type'] || {}).type) {
            case 'multipart':
                return processMultipartNode(node, options);
            case 'text':
                return processTextNode(node, options);
            case 'message':
                if (!options.attachmentRFC822) {
                    return processRFC822Node(node, options);
                }
                return processAttachmentNode(node, options);
            default:
                return processAttachmentNode(node, options);
        }
    };
    return walker(tree);
}
function createBodystructure(tree, options) {
    options = options || {};

    var walker = function(node) {
        switch((node.parsedHeader['content-type'] || {}).type) {
            case 'multipart':
                return processMultipartNode(node, options);
            case 'text':
                return processTextNode(node, options);
            case 'message':
                if (!options.attachmentRFC822) {
                    return processRFC822Node(node, options);
                }
                return processAttachmentNode(node, options);
            default:
                return processAttachmentNode(node, options);
        }
    };
    return walker(tree);
}
function createBodystructure ( tree , options ) { options = options || { } ; var walker = function ( node ) { switch ( ( node . parsedHeader [ 'content-type' ] || { } ) . type ) { case 'multipart' : return processMultipartNode ( node , options ) ; case 'text' : return processTextNode ( node , options ) ; case 'message' : if ( ! options . attachmentRFC822 ) { return processRFC822Node ( node , options ) ; } return processAttachmentNode ( node , options ) ; default : return processAttachmentNode ( node , options ) ; } } ; return walker ( tree ) ; }
Generates an object out of parsed mime tree, that can be
serialized into a BODYSTRUCTURE string

@param {Object} tree Parsed mime tree (see mimeparser.js for input)
@param {Object} [options] Optional options object
@param {Boolean} [options.contentLanguageString] If true, convert single element array to string for Content-Language
@param {Boolean} [options.upperCaseKeys] If true, use only upper case key names
@param {Boolean} [options.skipContentLocation] If true, do not include Content-Location in the output
@param {Boolean} [options.body] If true, skip extension fields (needed for BODY)
@param {Object} Object structure in the form of BODYSTRUCTURE
Generates an object out of parsed mime tree that can be serialized into a BODYSTRUCTURE string