Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/wa.picotech.app/public_html/node_modules/express-validator/src/ drwxr-xr-x |
Viewing file: Select action/file-type: "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.matchedData = void 0; const _ = require("lodash"); const base_1 = require("./base"); /** * Extracts data validated or sanitized from the request, and builds an object with them. * * @param req the express request object * @param options * @returns an object of data that's been validated or sanitized in the passed request */ function matchedData(req, options = {}) { const internalReq = req; const fieldExtractor = createFieldExtractor(options.includeOptionals !== true); const validityFilter = createValidityFilter(options.onlyValidData); const locationFilter = createLocationFilter(options.locations); return _(internalReq[base_1.contextsKey]) .flatMap(fieldExtractor) .filter(validityFilter) .map(field => field.instance) .filter(locationFilter) .reduce((state, instance) => _.set(state, instance.path, instance.value), {}) .valueOf(); } exports.matchedData = matchedData; function createFieldExtractor(removeOptionals) { return (context) => { const instances = context.getData({ requiredOnly: removeOptionals }); return instances.map((instance) => ({ instance, context })); }; } function createValidityFilter(onlyValidData = true) { return !onlyValidData ? () => true : (field) => { const hasError = field.context.errors.some(error => error.type === 'field' && error.location === field.instance.location && error.path === field.instance.path); return !hasError; }; } function createLocationFilter(locations = []) { // No locations mean all locations const allLocations = locations.length === 0; return allLocations ? () => true : (field) => locations.includes(field.location); } |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.006 ]-- |