From e4fa1e69e7ebfb627c7198fd1a9881e9327ec4d4 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 28 Jun 2025 17:26:46 -0700 Subject: initial commit: scaffolding --- .../date-fns/esm/formatDuration/index.d.ts | 4 + node_modules/date-fns/esm/formatDuration/index.js | 91 ++++++++++++++++++++++ .../date-fns/esm/formatDuration/index.js.flow | 60 ++++++++++++++ .../date-fns/esm/formatDuration/package.json | 4 + 4 files changed, 159 insertions(+) create mode 100644 node_modules/date-fns/esm/formatDuration/index.d.ts create mode 100644 node_modules/date-fns/esm/formatDuration/index.js create mode 100644 node_modules/date-fns/esm/formatDuration/index.js.flow create mode 100644 node_modules/date-fns/esm/formatDuration/package.json (limited to 'node_modules/date-fns/esm/formatDuration') diff --git a/node_modules/date-fns/esm/formatDuration/index.d.ts b/node_modules/date-fns/esm/formatDuration/index.d.ts new file mode 100644 index 0000000..be96776 --- /dev/null +++ b/node_modules/date-fns/esm/formatDuration/index.d.ts @@ -0,0 +1,4 @@ +// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it. + +import { formatDuration } from 'date-fns' +export default formatDuration diff --git a/node_modules/date-fns/esm/formatDuration/index.js b/node_modules/date-fns/esm/formatDuration/index.js new file mode 100644 index 0000000..7c87716 --- /dev/null +++ b/node_modules/date-fns/esm/formatDuration/index.js @@ -0,0 +1,91 @@ +import { getDefaultOptions } from "../_lib/defaultOptions/index.js"; +import defaultLocale from "../_lib/defaultLocale/index.js"; +var defaultFormat = ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds']; + +/** + * @name formatDuration + * @category Common Helpers + * @summary Formats a duration in human-readable format + * + * @description + * Return human-readable duration string i.e. "9 months 2 days" + * + * @param {Duration} duration - the duration to format + * @param {Object} [options] - an object with options. + * @param {string[]} [options.format=['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds']] - the array of units to format + * @param {boolean} [options.zero=false] - should zeros be included in the output? + * @param {string} [options.delimiter=' '] - delimiter string + * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} + * @returns {string} the formatted date string + * @throws {TypeError} 1 argument required + * + * @example + * // Format full duration + * formatDuration({ + * years: 2, + * months: 9, + * weeks: 1, + * days: 7, + * hours: 5, + * minutes: 9, + * seconds: 30 + * }) + * //=> '2 years 9 months 1 week 7 days 5 hours 9 minutes 30 seconds' + * + * @example + * // Format partial duration + * formatDuration({ months: 9, days: 2 }) + * //=> '9 months 2 days' + * + * @example + * // Customize the format + * formatDuration( + * { + * years: 2, + * months: 9, + * weeks: 1, + * days: 7, + * hours: 5, + * minutes: 9, + * seconds: 30 + * }, + * { format: ['months', 'weeks'] } + * ) === '9 months 1 week' + * + * @example + * // Customize the zeros presence + * formatDuration({ years: 0, months: 9 }) + * //=> '9 months' + * formatDuration({ years: 0, months: 9 }, { zero: true }) + * //=> '0 years 9 months' + * + * @example + * // Customize the delimiter + * formatDuration({ years: 2, months: 9, weeks: 3 }, { delimiter: ', ' }) + * //=> '2 years, 9 months, 3 weeks' + */ +export default function formatDuration(duration, options) { + var _ref, _options$locale, _options$format, _options$zero, _options$delimiter; + if (arguments.length < 1) { + throw new TypeError("1 argument required, but only ".concat(arguments.length, " present")); + } + var defaultOptions = getDefaultOptions(); + var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale; + var format = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat; + var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false; + var delimiter = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : ' '; + if (!locale.formatDistance) { + return ''; + } + var result = format.reduce(function (acc, unit) { + var token = "x".concat(unit.replace(/(^.)/, function (m) { + return m.toUpperCase(); + })); + var value = duration[unit]; + if (typeof value === 'number' && (zero || duration[unit])) { + return acc.concat(locale.formatDistance(token, value)); + } + return acc; + }, []).join(delimiter); + return result; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/formatDuration/index.js.flow b/node_modules/date-fns/esm/formatDuration/index.js.flow new file mode 100644 index 0000000..022ea8e --- /dev/null +++ b/node_modules/date-fns/esm/formatDuration/index.js.flow @@ -0,0 +1,60 @@ +// @flow +// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it. + +export type Interval = { + start: Date | number, + end: Date | number, +} + +export type Locale = { + code?: string, + formatDistance?: (...args: Array) => any, + formatRelative?: (...args: Array) => any, + localize?: { + ordinalNumber: (...args: Array) => any, + era: (...args: Array) => any, + quarter: (...args: Array) => any, + month: (...args: Array) => any, + day: (...args: Array) => any, + dayPeriod: (...args: Array) => any, + }, + formatLong?: { + date: (...args: Array) => any, + time: (...args: Array) => any, + dateTime: (...args: Array) => any, + }, + match?: { + ordinalNumber: (...args: Array) => any, + era: (...args: Array) => any, + quarter: (...args: Array) => any, + month: (...args: Array) => any, + day: (...args: Array) => any, + dayPeriod: (...args: Array) => any, + }, + options?: { + weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6, + firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7, + }, +} + +export type Duration = { + years?: number, + months?: number, + weeks?: number, + days?: number, + hours?: number, + minutes?: number, + seconds?: number, +} + +export type Day = 0 | 1 | 2 | 3 | 4 | 5 | 6 + +declare module.exports: ( + duration: Duration, + options?: { + format?: string[], + zero?: boolean, + delimiter?: string, + locale?: Locale, + } +) => string diff --git a/node_modules/date-fns/esm/formatDuration/package.json b/node_modules/date-fns/esm/formatDuration/package.json new file mode 100644 index 0000000..b109f05 --- /dev/null +++ b/node_modules/date-fns/esm/formatDuration/package.json @@ -0,0 +1,4 @@ +{ + "sideEffects": false, + "typings": "../../typings.d.ts" +} \ No newline at end of file -- cgit v1.2.3