From f0bf4e7afdcd8b02a62be45ab3e7d047ed865a79 Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Mon, 19 Jul 2021 20:06:08 +0300 Subject: Apply Prettier --- app/utils/validate.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'app/utils/validate.ts') diff --git a/app/utils/validate.ts b/app/utils/validate.ts index 91db9b6..862b2d0 100644 --- a/app/utils/validate.ts +++ b/app/utils/validate.ts @@ -1,4 +1,4 @@ -const ValidateJS = require("validate.js") +const ValidateJS = require('validate.js') // HACK(steve): wierd typescript situation because of strange typings const Validate: any = ValidateJS.default ? ValidateJS.default : ValidateJS @@ -6,7 +6,12 @@ const Validate: any = ValidateJS.default ? ValidateJS.default : ValidateJS /** * Validates that 1 attribute doesn't appear in another's attributes content. */ -Validate.validators.excludes = function custom(value, options, key, attributes) { +Validate.validators.excludes = function custom( + value, + options, + key, + attributes, +) { const list = attributes[options.attribute] || [] if (value && list.includes(value)) { return options.message || `${value} is in the list` @@ -69,8 +74,11 @@ export interface ValidationErrors { * @param rules The rules to apply. * @param data The object to validate. */ -export function validate(rules: ValidationRules, data: Record): ValidationErrors { - if (typeof data !== "object") { +export function validate( + rules: ValidationRules, + data: Record, +): ValidationErrors { + if (typeof data !== 'object') { return {} as ValidationErrors } return Validate(data, rules, { fullMessages: false }) || {} -- cgit v1.2.3