I have an array as follows:
var arr = [
{id: "a", val:1, val2: "i"},
{id: "b", val: 2, val2: "ii"},
{id: "c", val:3, val2: "iii"}
];
By using ramda I want to get an array as follows:
[{"id": "a"}, {"id": "b"}, {"id": "c"}]
So here I want to skip object attributes "val" & "val2"
I was able to do this by following approach:
var result = R.map(R.omit(['val', 'val2']))(arr);
Or you can also write it as follows:
var fn = R.map(R.omit(['val', 'val2']));
var result = fn(arr);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.