dataFromFunction = (func, options = {}) => {
const defaultOptions = {
start: 0,
step: 1,
length: 10,
};
const { start, step, length } = { ...defaultOptions, ...options };
return Array(length).fill().map((_, i) => start + (step * i)).map(x => ({ x, y: func(x) }));
};