function pulse(sources, lifeof, interval = d3.utcDay) {
return sources.flatMap((source) => {
const [start, end] = lifeof(source);
const dates = interval.range(interval.offset(interval.floor(start), -1), interval.offset(interval.floor(end), 2));
return dates.map((date, i) => {
return {
...source,
value: i === 0 || i === dates.length - 1 ? 0 : 1,
date
};
});
});
}