I use this code:
window.removeDuplicateLines = function() {
"use strict";
    var bodyText = $('#text-area').val().split('\n');
    var uniqueText = [];
    $.each(bodyText, function(i, el){
        if($.inArray(el, uniqueText) === -1) {
            uniqueText.push(el);
        }
    });
    document.getElementById('text-area').value = uniqueText.join('\n');
};
from here: Remove Duplicates from JavaScript Array to remove duplicate lines from the textarea.
This code works good, but it removes empty lines also as duplicates.
Question: How can I remove duplicate lines, but keep (ignore) empty lines, with this code?
 
     
    