Some checks are pending
Deploy Volleyball CMS / deploy (push) Waiting to run
93 lines
3.4 KiB
JavaScript
93 lines
3.4 KiB
JavaScript
// node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs
|
|
function buildFormatLongFn(args) {
|
|
return (options = {}) => {
|
|
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
const format = args.formats[width] || args.formats[args.defaultWidth];
|
|
return format;
|
|
};
|
|
}
|
|
|
|
// node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs
|
|
function buildLocalizeFn(args) {
|
|
return (value, options) => {
|
|
const context = (options == null ? void 0 : options.context) ? String(options.context) : "standalone";
|
|
let valuesArray;
|
|
if (context === "formatting" && args.formattingValues) {
|
|
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
const width = (options == null ? void 0 : options.width) ? String(options.width) : defaultWidth;
|
|
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
} else {
|
|
const defaultWidth = args.defaultWidth;
|
|
const width = (options == null ? void 0 : options.width) ? String(options.width) : args.defaultWidth;
|
|
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
}
|
|
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
return valuesArray[index];
|
|
};
|
|
}
|
|
|
|
// node_modules/date-fns/locale/_lib/buildMatchFn.mjs
|
|
function buildMatchFn(args) {
|
|
return (string, options = {}) => {
|
|
const width = options.width;
|
|
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
const matchResult = string.match(matchPattern);
|
|
if (!matchResult) {
|
|
return null;
|
|
}
|
|
const matchedString = matchResult[0];
|
|
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
findKey(parsePatterns, (pattern) => pattern.test(matchedString))
|
|
);
|
|
let value;
|
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
value = options.valueCallback ? (
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
options.valueCallback(value)
|
|
) : value;
|
|
const rest = string.slice(matchedString.length);
|
|
return { value, rest };
|
|
};
|
|
}
|
|
function findKey(object, predicate) {
|
|
for (const key in object) {
|
|
if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
|
|
return key;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
function findIndex(array, predicate) {
|
|
for (let key = 0; key < array.length; key++) {
|
|
if (predicate(array[key])) {
|
|
return key;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
|
|
// node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs
|
|
function buildMatchPatternFn(args) {
|
|
return (string, options = {}) => {
|
|
const matchResult = string.match(args.matchPattern);
|
|
if (!matchResult) return null;
|
|
const matchedString = matchResult[0];
|
|
const parseResult = string.match(args.parsePattern);
|
|
if (!parseResult) return null;
|
|
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
const rest = string.slice(matchedString.length);
|
|
return { value, rest };
|
|
};
|
|
}
|
|
|
|
export {
|
|
buildFormatLongFn,
|
|
buildLocalizeFn,
|
|
buildMatchFn,
|
|
buildMatchPatternFn
|
|
};
|
|
//# sourceMappingURL=chunk-A2TJQZIR.js.map
|