function moveArticleAfter(summary, origin, afterTarget) {
    // Coerce to level
    var originLevel = is.string(origin)? origin : origin.getLevel();
    var afterTargetLevel = is.string(afterTarget)? afterTarget : afterTarget.getLevel();
    var article = summary.getByLevel(originLevel);

    var targetLevel = increment(afterTargetLevel);

    if (targetLevel < origin) {
        // Remove first
        var removed = removeArticle(summary, originLevel);
        // Insert then
        return insertArticle(removed, article, targetLevel);
    } else {
        // Insert right after first
        var inserted = insertArticle(summary, article, targetLevel);
        // Remove old one
        return removeArticle(inserted, originLevel);
    }
}
function moveArticleAfter(summary, origin, afterTarget) {
    // Coerce to level
    var originLevel = is.string(origin)? origin : origin.getLevel();
    var afterTargetLevel = is.string(afterTarget)? afterTarget : afterTarget.getLevel();
    var article = summary.getByLevel(originLevel);

    var targetLevel = increment(afterTargetLevel);

    if (targetLevel < origin) {
        // Remove first
        var removed = removeArticle(summary, originLevel);
        // Insert then
        return insertArticle(removed, article, targetLevel);
    } else {
        // Insert right after first
        var inserted = insertArticle(summary, article, targetLevel);
        // Remove old one
        return removeArticle(inserted, originLevel);
    }
}
function moveArticleAfter ( summary , origin , afterTarget ) { // Coerce to level var originLevel = is . string ( origin ) ? origin : origin . getLevel ( ) ; var afterTargetLevel = is . string ( afterTarget ) ? afterTarget : afterTarget . getLevel ( ) ; var article = summary . getByLevel ( originLevel ) ; var targetLevel = increment ( afterTargetLevel ) ; if ( targetLevel < origin ) { // Remove first var removed = removeArticle ( summary , originLevel ) ; // Insert then return insertArticle ( removed , article , targetLevel ) ; } else { // Insert right after first var inserted = insertArticle ( summary , article , targetLevel ) ; // Remove old one return removeArticle ( inserted , originLevel ) ; } }
Returns a new summary, with the an article moved after another
article. Unlike `moveArticle`, does not ensure that the article
will be found at the target's level plus one.

@param {Summary} summary
@param {String|SummaryArticle} origin
@param {String|SummaryArticle} afterTarget
@return {Summary}
Returns a new summary with the an article moved after another article . Unlike moveArticle does not ensure that the article will be found at the target s level plus one .
Moves an article after another article