lib/srt.js
function(captions) {
        var SRT_BODY = [],
            counter = 1;
        captions.forEach(function(caption) {
            if (caption.text.length > 0 && validateText(caption.text)) {
                SRT_BODY.push(counter);
                SRT_BODY.push(module.exports.formatTime(caption.startTimeMicro) + ' --> ' + module.exports.formatTime(caption.endTimeMicro));
                SRT_BODY.push(module.exports.renderMacros(macros.fixItalics(macros.cleanMacros(caption.text))) + '\n');
                counter++;
            }
        });
        return SRT_BODY.join('\n');
    }
function(captions) {
        var SRT_BODY = [],
            counter = 1;
        captions.forEach(function(caption) {
            if (caption.text.length > 0 && validateText(caption.text)) {
                SRT_BODY.push(counter);
                SRT_BODY.push(module.exports.formatTime(caption.startTimeMicro) + ' --> ' + module.exports.formatTime(caption.endTimeMicro));
                SRT_BODY.push(module.exports.renderMacros(macros.fixItalics(macros.cleanMacros(caption.text))) + '\n');
                counter++;
            }
        });
        return SRT_BODY.join('\n');
    }
function ( captions ) { var SRT_BODY = [ ] , counter = 1 ; captions . forEach ( function ( caption ) { if ( caption . text . length > 0 && validateText ( caption . text ) ) { SRT_BODY . push ( counter ) ; SRT_BODY . push ( module . exports . formatTime ( caption . startTimeMicro ) + ' --> ' + module . exports . formatTime ( caption . endTimeMicro ) ) ; SRT_BODY . push ( module . exports . renderMacros ( macros . fixItalics ( macros . cleanMacros ( caption . text ) ) ) + '\n' ) ; counter ++ ; } } ) ; return SRT_BODY . join ( '\n' ) ; }
Generates SRT captions from JSON
@function
@param {array} captions - JSON array of captions
@public
Generates SRT captions from JSON