main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

60
node_modules/date-fns/locale/_lib/buildMatchFn.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
exports.buildMatchFn = buildMatchFn;
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 undefined;
}
function findIndex(array, predicate) {
for (let key = 0; key < array.length; key++) {
if (predicate(array[key])) {
return key;
}
}
return undefined;
}