users.map((user) => {
const findAppointments = appointments.find((item) => item.masterInfo.userId === user.userId && user.timings.some((time) => item.time.includes(time)));
if (!findAppointments) return null;
return user.timings.filter((time) => !findAppointments.time.includes(time));
}).flat();
[...new Map(arr.map((item) => [item["key"], item])).values()]
const uniqueIds = [];
arr.filter(element => {
const isDuplicate = uniqueIds.includes(element.key);
if (!isDuplicate) {
uniqueIds.push(element.key);
return true;
}
return false;
});
Object.values(
arr.reduce( (c, e) => {
if (!c[e.key]) c[e.key] = e;
return c;
}, {})
);
const unique = (arr, key) => {
const keys = new Set();
return arr.filter(el => !keys.has(el[key]) && keys.add(el[key]));
};
unique(arr, 'key')
var mySwiper2 = new Swiper('.swiper-container-two', {
slidesPerView: 'auto',
loop: true,
navigation: {
nextEl: '.lisenses .swiper-button-next',
prevEl: '.lisenses .swiper-button-prev',
},
breakpoints: {
320: {
slidesPerView: 1.5,
},
550: {
slidesPerView: 2.5,
},
768: {
slidesPerView: 3.5,
},
1080: {
slidesPerView: 'auto',
}
}
});
import {throttle} from 'lodash'
const throttled = throttle(() => console.log('throttle'), 1000)
throttled()