{"id":20252415,"url":"https://github.com/ivandotv/validar","last_synced_at":"2025-09-10T03:42:53.368Z","repository":{"id":35101368,"uuid":"206856958","full_name":"ivandotv/validar","owner":"ivandotv","description":"Easy object schema validation","archived":false,"fork":false,"pushed_at":"2025-09-04T12:59:18.000Z","size":341,"stargazers_count":2,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-04T14:43:23.702Z","etag":null,"topics":["object-schema","typescript","validate","validation","validation-runner"],"latest_commit_sha":null,"homepage":"https://ivandotv.github.io/validar/","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/ivandotv.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-09-06T18:59:56.000Z","updated_at":"2023-11-04T00:34:26.000Z","dependencies_parsed_at":"2023-01-15T13:52:20.249Z","dependency_job_id":"bf3a109c-c700-4a6e-8e6a-bccc45e46427","html_url":"https://github.com/ivandotv/validar","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ivandotv/validar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivandotv%2Fvalidar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivandotv%2Fvalidar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivandotv%2Fvalidar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivandotv%2Fvalidar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivandotv","download_url":"https://codeload.github.com/ivandotv/validar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivandotv%2Fvalidar/sbom","scorecard":{"id":498056,"data":{"date":"2025-08-11","repo":{"name":"github.com/ivandotv/validar","commit":"cfd7afc3ef865c0e1471d41354625e5e865b324f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T21:01:52.287Z","repository_id":35101368,"created_at":"2025-08-19T21:01:52.287Z","updated_at":"2025-08-19T21:01:52.287Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274408234,"owners_count":25279439,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["object-schema","typescript","validate","validation","validation-runner"],"created_at":"2024-11-14T10:16:36.205Z","updated_at":"2025-09-10T03:42:53.346Z","avatar_url":"https://github.com/ivandotv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validar\n\n[![CircleCI](https://img.shields.io/circleci/build/github/ivandotv/validar/master)](https://circleci.com/gh/ivandotv/validar)\n[![Codecov](https://img.shields.io/codecov/c/github/ivandotv/validar)](https://codecov.io/gh/ivandotv/validar)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/validar)\n![NPM](https://img.shields.io/npm/l/validar)\n\nDon't complicate your object schema validation.\n\nValidate objects synchronously or asynchronously.\n\n## Install\n\n```js\nnpm install validar\n```\n\n## Introduction\n\n**Validation runner doesn't contain any validation tests**, it is meant to be used with tried and tested validation libraries such as [Validator.js](https://github.com/validatorjs/validator.js) or you can write your own tests very easily.\n\n## Usage\n\nGiven an object with the data:\n\n```js\nconst person ={\n  name:'Adam'\n  location:{\n    country:'Canada',\n    city:'Montreal099',\n  }\n}\n// Note: fields on the testing object can be nested any number of levels.\n```\n\nAnd validation object like this:\n\n```js\nconst personValidators = {\n  name: isAlpha,\n  lastName: isAlpha,\n  occupation: isAlpha.required(),\n  location: {\n    country: [isString, isValidCountry], //multiple validators\n    city: isCityInValidCountry,\n  },\n}\n// isAlpha, isString, isValidCoutry, isCityInValidCountry are validation tests (more on that later)\n```\n\nLet’s validate the person object\n\n```js\n// this is the validation step\nconst result = validate(personValidators, person)\n```\n\nLet’s look at the result\n\nperson object will fail validation because:\n\n- `occupation` field does not exist on person object and it is required to exist.\n- `location.city` is not a valid city in Canada\n\nNote: `person` object will not fail validation because it lacks `lastName` field. The reason is because that field is not marked as `required` on the validation object. Validation object and object under test don’t have to have matching structure ( unless you want to ).\n\nThe result:\n\n```js\nresult = {\n    valid:false,\n    errors:[errorObj1,errorObj2],\n    struct:{\n        name:{\n            error:false,\n            missing:false,\n            value:'Adam',\n            field:'name',\n            path:'name'\n        }\n        occupation:{\n            error:true,\n            missing:true,\n            value:null,\n            field:'occupation',\n            path:'occupation',\n            message:'Field \"occupation\" not provided'\n        }\n        location:{\n            country:{\n                error:false,\n                missing:false,\n                value:'Canada',\n                field:'country',\n                path:'location.country'\n            },\n            city:{\n                error:true,\n                missing:false,\n                value:'Montreal099'\n                field:'city',\n                path:'location.city',\n                message:'Field \"location.city\" is not a valid city in Canada'\n            }\n        }\n    }\n}\n// result.errors[0] = result.struct.occupation\n// result.errors[1] = result.struct.location.city\n// result.missing[0] = result.struct.occuption\n```\n\n- _Errors_ are conveniently storred in the errors array on the result object.\n- _Missing_ fields are stored in the missing array on the result object.\n\n[runkit example](https://runkit.com/ivandotv/validar)\n\n### Asynchronous validation\n\nValidation tests can be asynchronous (talk to the database etc..) in that case you just use the `validateAsync` function and handle the promise that is returned when all validation tests are done.\n\n```js\nvalidateAsync(personValidators, person).then(result =\u003e {\n  console.log(result)\n})\n```\n\nasynchronous [runkit](https://runkit.com/ivandotv/async-validar-example) example\n\nCheck out documentation for more information about:\n\n- [Exploring result structure](https://ivandotv.github.io/validar/validate/validation-result)\n- [Creating validation tests](https://ivandotv.github.io/validar/validation/test-function)\n- [Asynchronous validation](https://ivandotv.github.io/validar/validate/validate-async)\n\n##### Author\n\n- **Ivan Vlatković**\n\n##### License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivandotv%2Fvalidar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivandotv%2Fvalidar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivandotv%2Fvalidar/lists"}