Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- ap_id: 23,
- name: "John",
- email: "John@domain.com",
- appointment_date: "23July,
- appointment_category: 3,
- time: "morning"
- },
- var result = _.chain(allAppointments)
- .groupBy('date')
- .mapObject( date => _.groupBy(date, 'email' ) )
- Response:
- {
- "23July": {
- "john@domain.com": [
- {
- "ap_id": 23,
- "name": "John",
- "email": "john@domain.com",
- "appointment_date": "23July",
- "appointment_category": 3,
- "time": "morning"
- },
- {
- "ap_id": 44,
- "name": "John",
- "email": "john@domain.com",
- "appointment_date": "23July",
- "appointment_category": 4,
- "time": "afternon"
- }
- ],
- "rose@domain.com": [
- {
- "ap_id": 55,
- "name": "Rose",
- "email": "rose@domain.com",
- "appointment_date": "23July",
- "appointment_category": 4,
- "time": "afternon"
- }
- ]
- },
- "29July": {
- "kate@domain.com": [
- {
- "ap_id": 70,
- "name": "Kate",
- "email": "kate@domain.com",
- "appointment_date": "29July",
- "appointment_category": 4,
- "time": "afternon"
- }
- ]
- }
- }
- allAppointments_Filtered:
- [{
- ap_id: 23,
- name: "John",
- email: "John@domain.com",
- appointment_date: tomorrow,
- appointment_category: 3,
- time: "morning",
- hasMultipleAppointmentOnDate: "yes"
- },{
- "ap_id": 55,
- "name": "Rose",
- "email": "rose@domain.com",
- "appointment_date": "23July",
- "appointment_category": 4,
- "time": "afternoon"
- hasMultipleAppointmentOnDate: "nope"
- },{
- "ap_id": 44,
- "name": "John",
- "email": "john@domain.com",
- "appointment_date": "23July",
- "appointment_category": 4,
- "time": "afternoon"
- hasMultipleAppointmentOnDate: "yes"
- },{
- ...
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement