code: function closest(array, value) {
  	  if (!is$1.array(array) || !array.length) {
  	    return null;
  	  }
  
  	  return array.reduce(function (prev, curr) {
  	    return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev;
  	  });
  	}
docs: Get the closest value in an array