title: immutablejs : find if map contains key value
body: <p>I am trying to determine whether or not a certain part of my immutable map contains a certain key value,  <code>checked: true</code>, and if so, set checked: true on the upper level. The object I am looking over looks like so:</p>
  
  <pre><code>const memo = {
    "Topics": {
      "filters": {
        "Psychological disorders": {
          "filters": {
            "Anxiety disorders": {
              "filters": {},
              "checked": true &lt;-- check for this value at this level
            }
          }
        }
      },
      "isOpen": false
    }
  }
  </code></pre>
  
  <p><em>Note: this data is actually immutable.</em></p>
  
  <p>So after the function ran it would change into this :</p>
  
  <pre><code>const memo = {
        "Topics": {
          "filters": {
            "Psychological disorders": {
              "checked": true, &lt;-- check true added
              "filters": {
                "Anxiety disorders": {
                  "filters": {},
                  "checked": true 
                }
              }
            }
          },
          "isOpen": false
        }
      }
  </code></pre>
  
  <p>The only var I have access to right now is the "Topics" name, so what I am trying to find out if is any Topics -> filters -> filters has <code>checked: true</code> inside it. Initially, i was trying to just toJS() this memo and check inside with lodash.</p>
  
  <p>Something like this :</p>
  
  <pre><code>_.find(memo['Topics'], _.flow(
      _.property('filters'),
      _.property('filters'),
      _.partialRight(_.any, { checked: true })
  ));
  </code></pre>
  
  <p>I can use this information to modify the object, but I am wondering if it is possible to achieve this without taking it out of immutable. So far I have tried this :</p>
  
  <pre><code>   const nameCheck = 'Topics';
  
     const hasCheckedFilters = memo.update(nameCheck, Map(),
          (oldResult) =&gt; oldResult.update('filters', Map(),   
              (oldSection) =&gt; {
                  // filters inside this object has checked : true, .set('checked', true);
                  const fromImmutable = oldSection.toJS();
                  const checkForChecked = _.find(fromImmutable.filters, {checked:true});
                 if(checkForChecked) {
                     oldSectsion.set('checked', true);
                 }
  
                }
              )
          )
      );
  </code></pre>
  
  <p>This does not seem to work because i am not looping over the filters. Would appreciate any input, Thanks!</p>