I have an array of objects. I want to filter it to get objects, which any property contains the mathing string.
If my array is
var data = [
{"name: "John",
"surname": "Smith"},
{"name": "Peter",
"surname: "Smithie"}]
I and filter with the string "Smi", it should return both items. If string is "John", only the first one.
This is my code:
var filtered = R.filter(R.where({ x: R.contains("Smi")}))(data);
I get error though:
Cannot read property 'indexOf' of undefined
Could someone help me out with my Ramda function? Must the something small I'm missing, I guess. Thanks in advance
where({x: contains('Smi')}), thexhas no meaning. Ramda does not include a notion of "for any key" like this.