title: How do I filter unique data-attr values from a jquery object map
body: <p>I have a plugin that finds all img elements within a given parent element. Some of the images are duplicates that I need to remove from the array. I'm thinking I can put them all into an array and then filter the duplicates out or while i'm traversing the map do some sort of conditional check but not quite sure how to do either</p>
  
  <p><strong>jq plugin</strong></p>
  
  <pre><code>(function( $ ){
    $.fn.cacheImages = function() {
      this.find('img').map(function(){
        if($(this).attr('data-src') == null ||$(this).attr('data-src') == 'null'){
          return;
        }
        else{
          //do something here if $(this).attr('data-src') has not bed traversed yet
        }
      });
    };
  })( jQuery );
  </code></pre>
  
  <p>then called like</p>
  
  <pre><code>  $('#something-with-images').cacheImages();
  </code></pre>