JavaScript remove duplicate lines from textarea, but keep (ignore) empty lines
<p>I use this code: </p>

<pre><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');
};
</code></pre>

<p>from here: <a href="https://stackoverflow.com/questions/9229645/remove-duplicates-from-javascript-array">Remove Duplicates from JavaScript Array</a> to remove duplicate lines from the textarea.</p>

<p>This code works good, but it removes empty lines also as duplicates.</p>

<p><strong>Question:</strong> How can I remove duplicate lines, but keep (ignore) empty lines, with this code?</p>