top5ipaddresses

node v8.11.4
version: 1.0.0
endpointsharetweet
var ipaddresses = ['1.2.3.5','1.2.3.4','1.2.3.5','1.2.3.4','1.2.3.5','1.2.3.4','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.6','1.2.3.6','1.2.3.6','1.2.3.6','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.8','1.2.3.9','1.2.3.10'] var counts = ipaddresses.reduce((map, ip) => { map[ip] = (map[ip] || 0) + 1 return map }, {}) var sorted = Object.keys(counts).sort((a, b) => counts[b] - counts[a]); var top5 = sorted.slice(0,5) return top5
Loading…

no comments

    sign in to comment