{"id":24582572,"url":"https://github.com/chopshop1/ez-validation","last_synced_at":"2025-04-24T04:50:42.282Z","repository":{"id":34275955,"uuid":"174256597","full_name":"chopshop1/ez-validation","owner":"chopshop1","description":"Validation made Ez","archived":false,"fork":false,"pushed_at":"2023-02-27T18:29:21.000Z","size":1991,"stargazers_count":15,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T10:57:51.594Z","etag":null,"topics":["angular","customizable","es6","ez","form-validation","javascript","js","react","svelte","typescript","validation","vue"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ez-validation","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chopshop1.png","metadata":{"files":{"readme":"readme.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-03-07T02:27:55.000Z","updated_at":"2022-06-09T01:21:54.000Z","dependencies_parsed_at":"2024-02-27T00:03:52.321Z","dependency_job_id":"460cd01e-f9a5-4561-869f-2f62349b1213","html_url":"https://github.com/chopshop1/ez-validation","commit_stats":null,"previous_names":["amad27/ez-validation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chopshop1%2Fez-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chopshop1%2Fez-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chopshop1%2Fez-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chopshop1%2Fez-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chopshop1","download_url":"https://codeload.github.com/chopshop1/ez-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250566445,"owners_count":21451230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","customizable","es6","ez","form-validation","javascript","js","react","svelte","typescript","validation","vue"],"created_at":"2025-01-24T03:24:03.366Z","updated_at":"2025-04-24T04:50:42.265Z","avatar_url":"https://github.com/chopshop1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/Amad27/ez-validation/blob/adding-logo/logo/EZ%201024.png?raw=true\" width=\"110\" align=\"right\" alt=\"ez-validation logo\"/\u003e\n\n![badge](https://github.com/amad27/ez-validation/workflows/npm%20publish/badge.svg)\n[![NPM version](https://img.shields.io/npm/v/ez-validation.svg)](https://www.npmjs.com/package/ez-validation)\n[![NPM downloads overall](https://img.shields.io/npm/dt/ez-validation.svg)](https://www.npmjs.com/package/ez-validation)\n[![NPM package size](https://img.shields.io/bundlephobia/minzip/ez-validation)](https://img.shields.io/bundlephobia/minzip/ez-validation)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n# Validation made Ez\n\n\u003e Who said Validation has to be hard and annoying!\n\nhttps://medium.com/@27amad27/validation-made-ez-50e72d6a0b29\n\n\u003chr/\u003e\n\n  \u003cdetails open\u003e\u003csummary\u003eAPI\u003c/summary\u003e\n  \u003cp\u003e\n\n| Function         | Params                  | Description                                                                                                |\n| ---------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |\n| required         | errorMessage            | checks if value is empty or not                                                                            |\n| isString         | errorMessage            | checks if value is a STRING                                                                                |\n| isBoolean        | errorMessage            | checks if value is a BOOLEAN                                                                               |\n| isNumber         | errorMessage            | checks if value is a INT                                                                                   |\n| isWholeNumber    | errorMessage            | checks if value is a Whole Number                                                                          |\n| isObject         | errorMessage            | checks if value is an OBJECT                                                                               |\n| isEmpty          | errorMessage            | checks if value is an EMPTY                                                                                |\n| isAlphanumeric   | errorMessage            | checks if value is Alphanumeric                                                                            |\n| isEmail          | errorMessage            | checks if value is valid Email                                                                             |\n| isPhoneNumber    | errorMessage            | checks if value is valid Phone Number                                                                      |\n| isUSAZipCode     | errorMessage            | checks if value is valid USA Zip Code                                                                      |\n| maxLength        | maxNumber, errorMessage | checks if value exceeds max length                                                                         |\n| minLength        | minNumber, errorMessage | checks if value is below min length                                                                        |\n| maxValue         | maxNumber, errorMessage | checks if value exceeds max number value                                                                   |\n| minValue         | minNumber, errorMessage | checks if value is below min number value                                                                  |\n| customRegex      |  regex, errorMessage    | pass in a custom regex                                                                                     |\n| customValidation |  cb, errorMessage       | pass in a custom call back that returns a Boolean False if there is an error True is there is not an error |\n\n  \u003c/p\u003e\n  \u003c/details\u003e\n\n\u003chr/\u003e\n\n  \u003cdetails open\u003e\u003csummary\u003eExamples\u003c/summary\u003e\n  \u003cp\u003e\n\n```javascript\nimport { EzValidation } from \"ez-validation\";\n\nval = \"asdf\";\nEzValidation(val).customValidation(\n  val =\u003e (val == \"asdf\" ? false : true),\n  \"Please enter valid response\"\n).errorMessage;\n// output = \"Please enter valid response\"\n\nval = 123;\nEzValidation(val)\n  .isNumber(\"I am not a number\")\n  .maxValue(100, \"Too large\").errorMessage;\n// output = \"Too large\"\n\nval = \"I am a large string\";\nEzValidation(val)\n  .isString()\n  .maxLength(4)\n  .required().errorMessage;\n// output = \"Exceeds maximum length of  4\"\n\nval = \"I am a large string\";\nEzValidation(val, \"DEFAULT ERROR\")\n  .isString()\n  .maxLength(4)\n  .required().errorMessage;\n// output = \"DEFAULT ERROR\"\n```\n\n  \u003c/p\u003e\n  \u003c/details\u003e\n\n\u003chr/\u003e\n\n  \u003cdetails open\u003e\u003csummary\u003eSchema Based Validation\u003c/summary\u003e\n  \u003cp\u003e\n  If you want to validate using a schema\n\n```javascript\nimport { schemaValidation } from \"ez-validations\";\n\nconst values = {\n  noValidation: \"hi\",\n  email: \"fake-email\",\n  name: \"im a cow\"\n};\n\nconst schema = {\n  email: (val: string) =\u003e\n    EzValidation(val)\n      .isEmail()\n      .required().errorMessage,\n  name: (val: string) =\u003e EzValidation(val).maxLength(2).errorMessage\n};\nschemaValidation(values, validationSchema);\n/* output: {\n  email: \"not a valid email\",\n  name: \"name length too long\"\n}\n*/\n```\n\n```javascript\nimport { schemaValidation } from \"ez-validations\";\n\nconst values = {\n  noValidation: \"hi\",\n  email: \"fake-email\",\n  name: \"im a cow\"\n};\n\nconst schema = {\n  email: {\n    validate: (val: string) =\u003e\n      EzValidation(val)\n        .isEmail()\n        .required().errorMessage\n  },\n  name: {\n    validate: (val: string) =\u003e EzValidation(val).maxLength(2).errorMessage\n  }\n};\nschemaValidation(values, schema, \"validate\");\n/* output: {\n  email: \"not a valid email\",\n  name: \"name length too long\"\n}\n*/\n```\n\n  \u003c/p\u003e\n  \u003c/details\u003e\n\n\u003chr/\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eAdvance Custom Usage\u003c/summary\u003e\n  \u003cp\u003e\n  If you have a validation method that isn't provided thats used often you can extend the ValidationAPI class to add your own methods!\n\n```javascript\nimport { EZValidationAPI } from \"ez-validation\";\n\nclass CustomEzValidation extends EZValidationAPI {\n  customMethod() {\n    if (this.validating == 0) {\n      this._returnError(\"value can't be 0\");\n    }\n    return this;\n  }\n}\nnew CustomEZValidation(0).customMethod().errorMessage;\n// \"value can't be 0\"\n```\n\n\u003c/p\u003e\n  \u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchopshop1%2Fez-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchopshop1%2Fez-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchopshop1%2Fez-validation/lists"}