These are chat archives for ramda/ramda

23rd
Jul 2018
Rahul Kumar Singh
@rahulsingh743
Jul 23 2018 07:40
hi
i have json data like "Data": [
{
"facility id": "1635",
"facility name": "Guts Gym - Kachiguda",
"latLong": "17.3909|78.4908",
"facility logo": "https://www.goodvice.com/GoodVice/uploads/facilitylogo/1635.jpg",
"Amenities": "Locker|Parking|WiFi",
"infrastructure_Type": "",
"area id": "683",
"metro_Name": "Hyderabad",
"google_Rating": "4.0",
"Rating": "4.0",
"Distance": 0.43,
"Promotion Flag": "0",
"pass_Status": "1",
"pass_redemption_Status": 0,
"offeringArray": [
{
"offering_Id": "1",
"offering_Fal_Rel_Id": "6047",
"Schedule Image": "",
"Price Per Session": "120",
"offering Name": "Gym",
"pass_redemption_Status": 0
},
{
"offering_Id": "16",
"offering_Fal_Rel_Id": "7016",
"Schedule Image": "",
"Price Per Session": "120",
"offering Name": "Spinning",
"pass_redemption_Status": 0
},
{
"offering_Id": "29",
"offering_Fal_Rel_Id": "7015",
"Schedule Image": "",
"Price Per Session": "120",
"offering Name": "Kickboxing",
"pass_redemption_Status": 0
}
]
},
{
"facility id": "2055",
"facility name": "MS Fitness Centre and Gym - King Koti",
"latLong": "17.3913308|78.4845719",
"facility logo": "https://www.goodvice.com/GoodVice/uploads/facilitylogo/2055.jpg",
"Amenities": "Parking|Shower|WiFi",
"infrastructure_Type": "",
"area id": "627",
"metro_Name": "Hyderabad",
"google_Rating": "4.1",
"Rating": "4.1",
"Distance": 0.89,
"Promotion Flag": "0",
"pass_Status": "1",
"pass_redemption_Status": 0,
"offeringArray": [
{
"offering_Id": "1",
"offering_Fal_Rel_Id": "7102",
"Schedule Image": "",
"Price Per Session": "99",
"offering Name": "Gym",
"pass_redemption_Status": 0
}
]
},
{
"facility id": "2123",
"facility name": "YMCA Kickboxing & Fitness",
"latLong": "17.3976103|78.4927214",
"facility logo": "https://www.goodvice.com/GoodVice/uploads/facilitylogo/2123.",
"Amenities": "Parking",
"infrastructure_Type": "",
"area id": "801",
"metro_Name": "Hyderabad",
"google_Rating": "4.2",
"Rating": "4.2",
"Distance": 1.17,
"Promotion Flag": "0",
"pass_Status": "1",
"pass_redemption_Status": 0,
"offeringArray": [
{
"offering_Id": "29",
"offering_Fal_Rel_Id": "7316",
"Schedule Image": "",
"Price Per Session": "99",
"offering Name": "Kickboxing",
"pass_redemption_Status": 0
}
]
},
{
"facility id": "1465",
"facility name": "Pulse8 Elite Gym - Barkatpura",
"latLong": "17.3948|78.4995",
"facility logo": "https://www.goodvice.com/GoodVice/uploads/facilitylogo/Pu.jpg",
"Amenities": "Locker|Steam|Parking|Shower",
"infrastructure_Type": "",
"area id": "641",
"metro_Name": "Hyderabad",
"google_Rating": "4.9",
"Rating": "4.9",
"Distance": 1.19,
"Promotion
i want to filter this data
using multiple condition
Denis Stoyanov
@xgrommx
Jul 23 2018 11:58
what is a fucking shit?
Brad Compton (he/him)
@Bradcomp
Jul 23 2018 16:07

@rahulsingh743 You can use triple tics to format a block of code:

// like this

That way we can see what's going on better, but no need to re-post all the data now.

I would probably have small filtering functions for each of your criteria, and then use allPass to build your filter.

// String -> (String -> Boolean)
const byMetroName = (name) => propEq("metro_Name", name);

// Array(String) -> (String -> Boolean)
const hasAmenities = (amenities) => compose(length, intersection(amenities),  split("|"));

//etc.

const theFilter = filter(allPass([byMetroName("Hyderabad"), hasAmenities(["Locker", "Parking"])]))

theFilter(ls);  // All results have shower and locker and are in Hyderabad metro area