title: lodash filter by property array of array
body: <p>I have array of users who have a property array 'rights' and I want to filter out the users who have specific rights. I would like to filter by an array so if I wanted all the users with full rights ['full'] or users with both full and edit ['full','edit'].  I am fairly new to using lodash and I think I can chain some together but I am not sure if this is there are more efficient ways of doing it.</p>
  
  <p>Here is my plunker: <a href="http://plnkr.co/edit/5PCvaDJaXF4uxRowVBlK?p=preview" rel="nofollow">http://plnkr.co/edit/5PCvaDJaXF4uxRowVBlK?p=preview</a></p>
  
  <p>Result  ['full'] :</p>
  
  <pre><code>[{
      "name": "Company1 Admin",
      "rights": [
        "full"
      ]
    },
    {
      "name": "FullRights Company1",
      "rights": [
        "full","review"
      ]
    }]
  </code></pre>
  
  <p>Result ['full','edit']:</p>
  
  <pre><code>[{
      "name": "Company1 Admin",
      "rights": [
        "full"
      ]
    },
    {
      "name": "FullRights Company1",
      "rights": [
        "full","review"
      ]
    },
    {
      "name": "EditRights Company1",
      "rights": [
        "edit"
      ]
    }]
  </code></pre>
  
  <p>Code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var users = [
        {
          "name": "Company1 Admin",
          "rights": [
            "full"
          ]
        },
        {
          "name": "FullRights Company1",
          "rights": [
            "full","review"
          ]
        },
        {
          "name": "ApproveRights Company1",
          "rights": [
            "approve","review"
          ]
        },
        {
          "name": "EditRights Company1",
          "rights": [
            "edit"
          ]
        },
        {
          "name": "ReviewRights Company1",
          "rights": [
            "review"
          ]
        },
        {
          "name": "NoRights Company1",
          "rights": [
            "none"
          ]
        }
      ];
          
  var tUsers = [];
  var filterRights = ['full','edit'];
  _.forEach(users, function(user) {
      if (_.intersection(user.rights, filterRights).length &gt; 0) {
        tUsers.push(user);
      }
  }) ;        
          
  //console.log('users', JSON.stringify(users, null, 2)); 
  console.log('tUsers', JSON.stringify(tUsers, null, 2));  
          </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>