Skip to content

Instantly share code, notes, and snippets.

@scabbiaza
Created December 11, 2016 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scabbiaza/4c6a0ef55ba5c3b4fe2bfefc52407e5e to your computer and use it in GitHub Desktop.
Save scabbiaza/4c6a0ef55ba5c3b4fe2bfefc52407e5e to your computer and use it in GitHub Desktop.
let R = require("ramda");
let data = [
{id: "6", manufacturer: "Russia"},
{id: "5", manufacturer: "USA"},
{id: "3", manufacturer: "China"},
{id: "2", manufacturer: "USA"},
{id: "4", manufacturer: "Russia"},
{id: "1", manufacturer: "RUSSIA"},
{id: "1", manufacturer: "Xyz"},
// {isTrue: true},
];
let pred = R.where({
id: R.equals(4),
// manufacturer: R.pipe(R.toLower, R.contains(R.toLower("Rus"))),
manufacturer: (value) => R.contains(R.toLower("Rus"), R.toLower(value)),
});
let result = R.filter(pred, data);
console.log('result: ', result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment