lib/index.js
function (source, opts, cb) {
        var callback,
            options;

        if (arguments.length === 2) {
            options = defaults();
            callback = opts;
        } else {
            options = defaults(opts);
            callback = cb;
        }

        try {
            source = api.clean(source);
            callback(null, api.insert(source, getToc(source, options)));
        } catch (err) {
            callback(err, null);
        }
    }
function (source, opts, cb) {
        var callback,
            options;

        if (arguments.length === 2) {
            options = defaults();
            callback = opts;
        } else {
            options = defaults(opts);
            callback = cb;
        }

        try {
            source = api.clean(source);
            callback(null, api.insert(source, getToc(source, options)));
        } catch (err) {
            callback(err, null);
        }
    }
function ( source , opts , cb ) { var callback , options ; if ( arguments . length === 2 ) { options = defaults ( ) ; callback = opts ; } else { options = defaults ( opts ) ; callback = cb ; } try { source = api . clean ( source ) ; callback ( null , api . insert ( source , getToc ( source , options ) ) ) ; } catch ( err ) { callback ( err , null ) ; } }
Inserts a TOC object into a source
@param {String} source
@param {Object} [opts]
@param {Number} [opts.maxDepth]
@param {Char}   [opts.bullet]
@param {Function} cb
Inserts a TOC object into a source