Code Duplication    Length = 21-21 lines in 2 locations

Resources/Public/JavaScript/editormd/editormd.js 2 locations

@@ 3038-3058 (lines=21) @@
3035
            }
3036
        },
3037
3038
        "list-ol" : function() {
3039
            var cm        = this.cm;
3040
            var cursor    = cm.getCursor();
3041
            var selection = cm.getSelection();
3042
3043
            if(selection === "") 
3044
            {
3045
                cm.replaceSelection("1. " + selection);
3046
            }
3047
            else
3048
            {
3049
                var selectionText = selection.split("\n");
3050
3051
                for (var i = 0, len = selectionText.length; i < len; i++) 
3052
                {
3053
                    selectionText[i] = (selectionText[i] === "") ? "" : (i+1) + ". " + selectionText[i];
3054
                }
3055
3056
                cm.replaceSelection(selectionText.join("\n"));
3057
            }
3058
        },
3059
3060
        hr : function() {
3061
            var cm        = this.cm;
@@ 3016-3036 (lines=21) @@
3013
            }
3014
        },
3015
3016
        "list-ul" : function() {
3017
            var cm        = this.cm;
3018
            var cursor    = cm.getCursor();
3019
            var selection = cm.getSelection();
3020
3021
            if (selection === "") 
3022
            {
3023
                cm.replaceSelection("- " + selection);
3024
            } 
3025
            else 
3026
            {
3027
                var selectionText = selection.split("\n");
3028
3029
                for (var i = 0, len = selectionText.length; i < len; i++) 
3030
                {
3031
                    selectionText[i] = (selectionText[i] === "") ? "" : "- " + selectionText[i];
3032
                }
3033
3034
                cm.replaceSelection(selectionText.join("\n"));
3035
            }
3036
        },
3037
3038
        "list-ol" : function() {
3039
            var cm        = this.cm;