mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
1 line
6.0 KiB
JSON
1 line
6.0 KiB
JSON
{"ast":null,"code":"import addMinutes from \"../addMinutes/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport startOfMinute from \"../startOfMinute/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name eachMinuteOfInterval\n * @category Interval Helpers\n * @summary Return the array of minutes within the specified time interval.\n *\n * @description\n * Returns the array of minutes within the specified time interval.\n *\n * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The starts of minutes from the hour of the interval start to the hour of the interval end\n * @throws {TypeError} 1 argument requie value should be more than 1.\n * @returns {Date[]} the array withred\n * @throws {RangeError} `options.step` must be a number equal or greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each minute between 14 October 2020, 13:00 and 14 October 2020, 13:03\n * const result = eachMinuteOfInterval({\n * start: new Date(2014, 9, 14, 13),\n * end: new Date(2014, 9, 14, 13, 3)\n * })\n * //=> [\n * // Wed Oct 14 2014 13:00:00,\n * // Wed Oct 14 2014 13:01:00,\n * // Wed Oct 14 2014 13:02:00,\n * // Wed Oct 14 2014 13:03:00\n * // ]\n */\nexport default function eachMinuteOfInterval(interval, options) {\n requiredArgs(1, arguments);\n var startDate = startOfMinute(toDate(interval.start));\n var endDate = startOfMinute(toDate(interval.end));\n var startTime = startDate.getTime();\n var endTime = endDate.getTime();\n if (startTime >= endTime) {\n throw new RangeError('Invalid interval');\n }\n var dates = [];\n var currentDate = startDate;\n var step = options && 'step' in options ? Number(options.step) : 1;\n if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number equal or greater than 1');\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate));\n currentDate = addMinutes(currentDate, step);\n }\n return dates;\n}","map":{"version":3,"names":["addMinutes","toDate","startOfMinute","requiredArgs","eachMinuteOfInterval","interval","options","arguments","startDate","start","endDate","end","startTime","getTime","endTime","RangeError","dates","currentDate","step","Number","isNaN","push"],"sources":["C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/date-fns/esm/eachMinuteOfInterval/index.js"],"sourcesContent":["import addMinutes from \"../addMinutes/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport startOfMinute from \"../startOfMinute/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name eachMinuteOfInterval\n * @category Interval Helpers\n * @summary Return the array of minutes within the specified time interval.\n *\n * @description\n * Returns the array of minutes within the specified time interval.\n *\n * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The starts of minutes from the hour of the interval start to the hour of the interval end\n * @throws {TypeError} 1 argument requie value should be more than 1.\n * @returns {Date[]} the array withred\n * @throws {RangeError} `options.step` must be a number equal or greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each minute between 14 October 2020, 13:00 and 14 October 2020, 13:03\n * const result = eachMinuteOfInterval({\n * start: new Date(2014, 9, 14, 13),\n * end: new Date(2014, 9, 14, 13, 3)\n * })\n * //=> [\n * // Wed Oct 14 2014 13:00:00,\n * // Wed Oct 14 2014 13:01:00,\n * // Wed Oct 14 2014 13:02:00,\n * // Wed Oct 14 2014 13:03:00\n * // ]\n */\nexport default function eachMinuteOfInterval(interval, options) {\n requiredArgs(1, arguments);\n var startDate = startOfMinute(toDate(interval.start));\n var endDate = startOfMinute(toDate(interval.end));\n var startTime = startDate.getTime();\n var endTime = endDate.getTime();\n\n if (startTime >= endTime) {\n throw new RangeError('Invalid interval');\n }\n\n var dates = [];\n var currentDate = startDate;\n var step = options && 'step' in options ? Number(options.step) : 1;\n if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number equal or greater than 1');\n\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate));\n currentDate = addMinutes(currentDate, step);\n }\n\n return dates;\n}"],"mappings":"AAAA,OAAOA,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,aAAa,MAAM,2BAA2B;AACrD,OAAOC,YAAY,MAAM,+BAA+B;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAACC,QAAQ,EAAEC,OAAO,EAAE;EAC9DH,YAAY,CAAC,CAAC,EAAEI,SAAS,CAAC;EAC1B,IAAIC,SAAS,GAAGN,aAAa,CAACD,MAAM,CAACI,QAAQ,CAACI,KAAK,CAAC,CAAC;EACrD,IAAIC,OAAO,GAAGR,aAAa,CAACD,MAAM,CAACI,QAAQ,CAACM,GAAG,CAAC,CAAC;EACjD,IAAIC,SAAS,GAAGJ,SAAS,CAACK,OAAO,CAAC,CAAC;EACnC,IAAIC,OAAO,GAAGJ,OAAO,CAACG,OAAO,CAAC,CAAC;EAE/B,IAAID,SAAS,IAAIE,OAAO,EAAE;IACxB,MAAM,IAAIC,UAAU,CAAC,kBAAkB,CAAC;EAC1C;EAEA,IAAIC,KAAK,GAAG,EAAE;EACd,IAAIC,WAAW,GAAGT,SAAS;EAC3B,IAAIU,IAAI,GAAGZ,OAAO,IAAI,MAAM,IAAIA,OAAO,GAAGa,MAAM,CAACb,OAAO,CAACY,IAAI,CAAC,GAAG,CAAC;EAClE,IAAIA,IAAI,GAAG,CAAC,IAAIE,KAAK,CAACF,IAAI,CAAC,EAAE,MAAM,IAAIH,UAAU,CAAC,yDAAyD,CAAC;EAE5G,OAAOE,WAAW,CAACJ,OAAO,CAAC,CAAC,IAAIC,OAAO,EAAE;IACvCE,KAAK,CAACK,IAAI,CAACpB,MAAM,CAACgB,WAAW,CAAC,CAAC;IAC/BA,WAAW,GAAGjB,UAAU,CAACiB,WAAW,EAAEC,IAAI,CAAC;EAC7C;EAEA,OAAOF,KAAK;AACd"},"metadata":{},"sourceType":"module"} |