Repository: date-fns/date-fns
File: src/set/index.js (JavaScript)

Code before:
import toDate from '../toDate/index.js'
import toInteger from '../_lib/toInteger/index.js'
import setMonth from '../setMonth/index.js'

/**
 * @name set
 * @category Common Helpers
 * @summary Set the object to a given date
 *
 * @description
 * Set the object to a given date
 *
 * @param {Date|Number} date - the date to be changed
 * @param {Object} [options] - an object with options
 * @param {Number} [options.years=0] - the number of years to be set
 * @param {Number} [options.months=0] - the number of months to be set
 * @param {Number} [options.days=0] - the number of days to be set
 * @param {Number} [options.hours=0] - the number of hours to be set
 * @param {Number} [options.minutes=0] - the number of minutes to be set
 * @param {Number} [options.seconds=0] - the number of seconds to be set
 * @param {Number} [options.milliseconds=0] - the number of milliseconds to be set
 * @returns {Date} the new date with options set
 * @throws {TypeError} 2 arguments required
 * @throws {RangeError} The options object must only contain number properties
 * @throws {RangeError} The options object must not contain a NaN
 */

export default function set(dirtyDate, dirtyOptions) {
  if (arguments.length < 2) {
    throw new TypeError(
      '2 arguments required, but only ' + arguments.length + ' present'
    )
  }

  var options = dirtyOptions || {}

  // check if properties of object are numbers and not NaN
  var isNumbers = Object.values(options).every(x => typeof x === 'number')
  var hasNaN = Object.values(options).every(x => isNaN(x))

Review comment (suggestion):
`options` is a special argument in date-fns and is used to store all optional parameters. It has special behaviour for FP functions: if a function `x` [has this argument](https://github.com/date-fns/date-fns/blob/master/scripts/build/docs.js#L283) then it recieves two corresponding FP functions: `fp/x` and `fp/xWithOptions` (reflecting `options`' optional nature)

So, please rename it to something else like `values`

Code after:
import toDate from '../toDate/index.js'
import setMonth from '../setMonth/index.js'
import toInteger from '../_lib/toInteger/index.js'

/**
 * @name set
 * @category Common Helpers
 * @summary Set date values to a given date.
 *
 * @description
 * Set date values to a given date.
 *
 * Sets time values to date from object `values`.
 * A value is not set if it is undefined or null or doesn't exist in `values`.
 *
 * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
 * to use native `Date#setX` methods. If you use this function, you may not want to include the
 * other `setX` functions that date-fns provides if you are concerned about the bundle size.
 *
 * @param {Date|Number} date - the date to be changed
 * @param {Object} values - an object with options
 * @param {Number} values.year - the number of years to be set
 * @param {Number} values.month - the number of months to be set
 * @param {Number} values.date - the number of days to be set
 * @param {Number} values.hours - the number of hours to be set
 * @param {Number} values.minutes - the number of minutes to be set
 * @param {Number} values.seconds - the number of seconds to be set
 * @param {Number} values.milliseconds - the number of milliseconds to be set
 * @returns {Date} the new date with options set
 * @throws {TypeError} 2 arguments required
 * @throws {RangeError} `values` must be an object
 *
 * @example
 * // Transform 1 September 2014 into 20 October 2015 in a single line:
 * var result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
 * //=> Tue Oct 20 2015 00:00:00
 *
 * @example
 * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00: