SpaceAlarm,
let getIP = `
17.11.2023 06:27:17 213.151.11.164
17.11.2023 08:19:56 213.151.20.77
17.11.2023 10:45:44 213.151.20.77`;
let userIp = {};
let uniqueArray = [];
let arr = getIP.match(/\S+/gm);
for (let i = 0; i < arr.length; i++) {
let data = `${arr[i]} ${arr[++i]}`;
let ip = arr[++i];
if (ip in userIp) userIp[ip].date.push(data);
else {
let obj = {
ip,
date: [data]
};
userIp[ip] = obj;
uniqueArray.push(obj)
}
}
console.log(uniqueArray)