export const snapTo = (target, points) => {
  return points.length === 0 ?
  // extreme last case if there are no points somehow
  target : points.reduce((point, closest) => {
    return Math.abs(closest - target) < Math.abs(point - target) ? closest : point;
  });
};