jLinux

Untitled

Dec 26th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. function uniqObjs( arr ) {
  4.     let uniques = [];
  5.    
  6.     return _.filter( arr, ( a ) => {
  7.         if( _.indexOf( uniques, JSON.stringify(a) ) === -1 ){
  8.             uniques.push( JSON.stringify(a) );
  9.             return true;
  10.         }
  11.        
  12.         return false;
  13.     });
  14. }
  15.  
  16. _.mixin({ 'uniqObjs': uniqObjs });
Advertisement
Add Comment
Please, Sign In to add comment