"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.snapTo = void 0;
var snapTo = exports.snapTo = function snapTo(target, points) {
  return points.length === 0 ?
  // extreme last case if there are no points somehow
  target : points.reduce(function (point, closest) {
    return Math.abs(closest - target) < Math.abs(point - target) ? closest : point;
  });
};