{"ast":null,"code":"import { getDefaultOptions, setDefaultOptions as setInternalDefaultOptions } from \"./_lib/defaultOptions.mjs\";\n\n/**\n * @name setDefaultOptions\n * @category Common Helpers\n * @summary Set default options including locale.\n * @pure false\n *\n * @description\n * Sets the defaults for\n * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`\n * arguments for all functions.\n *\n * @param options - An object with options\n *\n * @example\n * // Set global locale:\n * import { es } from 'date-fns/locale'\n * setDefaultOptions({ locale: es })\n * const result = format(new Date(2014, 8, 2), 'PPPP')\n * //=> 'martes, 2 de septiembre de 2014'\n *\n * @example\n * // Start of the week for 2 September 2014:\n * const result = startOfWeek(new Date(2014, 8, 2))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // Start of the week for 2 September 2014,\n * // when we set that week starts on Monday by default:\n * setDefaultOptions({ weekStartsOn: 1 })\n * const result = startOfWeek(new Date(2014, 8, 2))\n * //=> Mon Sep 01 2014 00:00:00\n *\n * @example\n * // Manually set options take priority over default options:\n * setDefaultOptions({ weekStartsOn: 1 })\n * const result = startOfWeek(new Date(2014, 8, 2), { weekStartsOn: 0 })\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // Remove the option by setting it to `undefined`:\n * setDefaultOptions({ weekStartsOn: 1 })\n * setDefaultOptions({ weekStartsOn: undefined })\n * const result = startOfWeek(new Date(2014, 8, 2))\n * //=> Sun Aug 31 2014 00:00:00\n */\nexport function setDefaultOptions(options) {\n  const result = {};\n  const defaultOptions = getDefaultOptions();\n  for (const property in defaultOptions) {\n    if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) {\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type\n      result[property] = defaultOptions[property];\n    }\n  }\n  for (const property in options) {\n    if (Object.prototype.hasOwnProperty.call(options, property)) {\n      if (options[property] === undefined) {\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type\n        delete result[property];\n      } else {\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type\n        result[property] = options[property];\n      }\n    }\n  }\n  setInternalDefaultOptions(result);\n}\n\n// Fallback for modularized imports:\nexport default setDefaultOptions;","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}