MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / activity

Function activity

code/hangar2.js:24–37  ·  view source on GitHub ↗
(day, base)

Source from the content-addressed store, hash-verified

22 let sunday = [2, 2, 1, 1, 1, 1, 1, 2, 2, 3, 6, 6, 2, 1, 1, 1, 1, 4, 4, 4, 3, 2, 1, 1]
23
24 let activity = (day, base) => {
25 let schedule = day == 0 ? sunday : day == 6 ? saturday : weekday
26 let events = []
27 for (let h = 0; h < 24; h++) {
28 let n = schedule[h] * 2 + r(5) - 2
29 for (let i = 0; i < n; i++) {
30 let t = base + h * hour + r(hour)
31 let j = events.length
32 while (j > 0 && events[j - 1] > t) --j
33 events.splice(j, 0, t)
34 }
35 }
36 return events
37 }
38
39 let generated = false
40 function generateLogs() {

Callers 1

generateLogsFunction · 0.85

Calls 1

rFunction · 0.85

Tested by

no test coverage detected