Would like this function to return when a string matches a value in an object partially or completely
<p>I'm trying to filter using javascript and lodash. The search is performed using an input field and I want this function to return when <code>this.props.search</code> matches a value in the <code>file</code> object partially or completely. Without using the object's key names.</p>

<pre><code>let files = [{
    'id': '00001',
    'fileName' : 'Test01.test',
    'size': 105,
    'uploadDate' : '2016-02-12',
    'permissions' : 'Private'
}, {
    'id': '00002',
    'fileName' : 'Test02.test',
    'size': 111,
    'uploadDate' : '2016-02-10',
    'permissions' : 'Private'
}, {
    'id': '00003',
    'fileName' : 'Test03.test',
    'size': 55,
    'uploadDate' : '2016-02-06',
    'permissions' : 'Shared'
}];

let filteredFiles = files.filter((file) =&gt; {
    return _.includes(file, this.props.search);
});
</code></pre>

<p>But using the function it will only work when it matches the string completetly. What am I doing wrong? I am open to not using lodash also if there's a suggestion.</p>

<p><strong>UPDATE:</strong></p>

<p>I end up using the following:</p>

<pre><code>   let filteredFiles = this.props.files.filter((file) =&gt; {
        for (let prop in file) {
            let string = String(file[prop]).toLowerCase();
            if (string.indexOf(this.props.search.toLowerCase()) &gt;= 0) {
                return true;
            }
        }
        return false;
    });
</code></pre>