lib/smi.js
function(data) {
        var SAMI_BODY = '',
            captions = data;

        SAMI_BODY += SAMI.header.join('\n') + '\n';
        captions.forEach(function(caption) {
            if (caption.text === '') {
                caption.text = '&nbsp;';
            }
            SAMI_BODY += SAMI.lineTemplate.replace('{startTime}', Math.floor(caption.startTimeMicro / 1000))
                .replace('{text}', module.exports.renderMacros(caption.text)) + '\n';
        });

        return SAMI_BODY + SAMI.footer.join('\n') + '\n';
    }
function(data) {
        var SAMI_BODY = '',
            captions = data;

        SAMI_BODY += SAMI.header.join('\n') + '\n';
        captions.forEach(function(caption) {
            if (caption.text === '') {
                caption.text = '&nbsp;';
            }
            SAMI_BODY += SAMI.lineTemplate.replace('{startTime}', Math.floor(caption.startTimeMicro / 1000))
                .replace('{text}', module.exports.renderMacros(caption.text)) + '\n';
        });

        return SAMI_BODY + SAMI.footer.join('\n') + '\n';
    }
function ( data ) { var SAMI_BODY = '' , captions = data ; SAMI_BODY += SAMI . header . join ( '\n' ) + '\n' ; captions . forEach ( function ( caption ) { if ( caption . text === '' ) { caption . text = '&nbsp;' ; } SAMI_BODY += SAMI . lineTemplate . replace ( '{startTime}' , Math . floor ( caption . startTimeMicro / 1000 ) ) . replace ( '{text}' , module . exports . renderMacros ( caption . text ) ) + '\n' ; } ) ; return SAMI_BODY + SAMI . footer . join ( '\n' ) + '\n' ; }
generates SAMI from JSON
@function
@public
@param {string} data - proprietary JSON data to translate to SAMI
generates SAMI from JSON