UNPKG

express-image-validator

Version:

Validator of various image parameters in Express.js applications

25 lines (24 loc) 902 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.readingError = exports.largeDiffError = exports.unableReadError = void 0; const unableReadError = (field, fileName, aspectRatio) => ({ field, msg: 'Unable to read image dimensions for aspect ratio check', value: aspectRatio, filename: fileName, }); exports.unableReadError = unableReadError; const largeDiffError = (field, fileName, actualAspectRatio, aspectRatio) => ({ field, msg: `Image aspect ratio ${actualAspectRatio} does not match required ~${aspectRatio.toFixed(2)}`, value: aspectRatio, filename: fileName, }); exports.largeDiffError = largeDiffError; const readingError = (field, fileName, aspectRatio) => ({ field, msg: 'Error reading image file for aspect ratio validation', value: aspectRatio, filename: fileName, }); exports.readingError = readingError;