decord/source/1931_buildMatchFn.js
2026-07-20 16:05:17 +00:00

84 lines
2.2 KiB
JavaScript

// Module ID: 1931
// Function ID: 21793
// Name: buildMatchFn
// Dependencies: []
// Exports: default
// Module 1931 (buildMatchFn)
export default function buildMatchFn(arg0) {
return (str) => {
if (arguments.length > 1) {
if (undefined !== arguments[1]) {
let obj = arguments[1];
}
const width = obj.width;
let tmp2 = width;
if (width) {
tmp2 = str.matchPatterns[width];
}
if (!tmp2) {
tmp2 = str.matchPatterns[closure_0.defaultMatchWidth];
}
const match = str.match(tmp2);
if (match) {
const first = match[0];
let arr2 = width;
if (width) {
arr2 = str.parsePatterns[width];
}
if (!arr2) {
arr2 = str.parsePatterns[closure_0.defaultParseWidth];
}
const _Array = Array;
if (Array.isArray(arr2)) {
let num2 = 0;
let tmp15;
if (0 < arr2.length) {
tmp15 = num2;
while (!obj3.test(first)) {
num2 = num2 + 1;
if (num2 >= arr2.length) {
break;
}
}
const obj3 = arr2[num2];
}
let tmp12 = tmp15;
} else {
const keys = Object.keys();
if (keys !== undefined) {
while (keys[tmp] !== undefined) {
let tmp20 = tmp14;
if (!arr2.hasOwnProperty(tmp14)) {
continue;
} else {
let obj2 = arr2[tmp14];
tmp12 = tmp14;
if (obj2.test(first)) {
break;
}
}
continue;
}
}
}
let valueCallbackResult = tmp12;
if (str.valueCallback) {
valueCallbackResult = str.valueCallback(tmp12);
}
obj = {};
if (obj.valueCallback) {
valueCallbackResult = obj.valueCallback(valueCallbackResult);
}
obj.value = valueCallbackResult;
obj.rest = str.slice(first.length);
return obj;
} else {
return null;
}
}
obj = {};
};
};
export default exports.default;