CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-vuelidate--validators

Comprehensive validation library for Vue.js applications providing common validators with built-in error messages and customization options

87

1.14x
Overview
Eval results
Files

task.mdevals/scenario-6/

User Profile Form Validation System

Build a reusable form validation system for user profiles that can be shared across multiple forms in an application. The system should handle various profile types with different validation requirements while promoting code reuse.

Requirements

Create a validation system that:

  1. Defines reusable validation rule sets that can be applied to different form types
  2. Supports two profile types:
    • Personal Profile: Requires username, email, and age (must be 18 or older)
    • Admin Profile: Requires username, email, password, and confirmation password (must match password)
  3. Implements shared validation logic that can be composed and reused across profile types
  4. Uses factory functions or composable patterns to generate validator configurations

Validation Rules

Personal Profile

  • Username: Required
  • Email: Required, valid email format
  • Age: Required, minimum value 18

Admin Profile

  • Username: Required
  • Email: Required, valid email format
  • Password: Required
  • Confirm Password: Required, must match password field

Test Cases

  • Creating a personal profile with valid data (username: "john123", email: "john@example.com", age: 25) passes validation @test
  • Creating a personal profile with age 17 fails validation @test
  • Creating an admin profile where password and confirm password match passes validation @test
  • Creating an admin profile where passwords don't match fails validation @test

Implementation

@generates

API

/**
 * Creates validation rules for a personal profile form
 * @returns {Object} Validation rules object
 */
function createPersonalProfileValidation() {
  // IMPLEMENTATION HERE
}

/**
 * Creates validation rules for an admin profile form
 * @returns {Object} Validation rules object
 */
function createAdminProfileValidation() {
  // IMPLEMENTATION HERE
}

module.exports = {
  createPersonalProfileValidation,
  createAdminProfileValidation
};

Dependencies { .dependencies }

@vuelidate/validators { .dependency }

Provides form validation support with composable validators.

Install with Tessl CLI

npx tessl i tessl/npm-vuelidate--validators

tile.json