{"id":20442888,"url":"https://github.com/mrbrunelli/object-validator","last_synced_at":"2025-04-12T23:45:15.496Z","repository":{"id":43924921,"uuid":"455698499","full_name":"mrbrunelli/object-validator","owner":"mrbrunelli","description":"A simple object validator for tiny schemas","archived":false,"fork":false,"pushed_at":"2022-10-18T21:01:03.000Z","size":157,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T23:44:47.151Z","etag":null,"topics":["fields-validator","javascript","object-validator","schema-validator","validator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@mrbrunelli/object-validator","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/mrbrunelli.png","metadata":{"files":{"readme":"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}},"created_at":"2022-02-04T21:14:29.000Z","updated_at":"2022-02-14T19:59:48.000Z","dependencies_parsed_at":"2022-09-19T08:11:58.043Z","dependency_job_id":null,"html_url":"https://github.com/mrbrunelli/object-validator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrbrunelli%2Fobject-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrbrunelli%2Fobject-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrbrunelli%2Fobject-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrbrunelli%2Fobject-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrbrunelli","download_url":"https://codeload.github.com/mrbrunelli/object-validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647259,"owners_count":21139081,"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":["fields-validator","javascript","object-validator","schema-validator","validator"],"created_at":"2024-11-15T09:43:22.321Z","updated_at":"2025-04-12T23:45:15.467Z","avatar_url":"https://github.com/mrbrunelli.png","language":"TypeScript","readme":"# Object Validator\n\nA Javascript object validator for tiny schemas.\n\n[![NPM](https://nodei.co/npm/@mrbrunelli/object-validator.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/@mrbrunelli/object-validator/)\n\n![Test](https://github.com/mrbrunelli/object-validator/actions/workflows/test.yml/badge.svg)\n\n## Get started\n\n```sh\n yarn add @mrbrunelli/object-validator\n```\n\n#### How to use\n\n```ts\nimport Validate from '@mrbrunelli/object-validator'\n\nconst objectExample = {\n  foo: {\n    bar: {\n      message: 'Hello!'\n    }\n  }\n}\n\nconst isValid = Validate.isValid(objectExample, [\n  ['foo'],\n  ['foo.bar.message', 'Hello!']\n])\nconsole.log(isValid) // returns true\n```\n\n#### Why\n\nValidating multiple fields can be very tiring in old Node versions.\n\n```js\n  // Work only Node 14 or \u003e\n  if (objectExample?.foo?.bar?.message === 'Hello!') // anything...\n```\n\nNode 12 require massive validations.\n\n```js\n  if (objectExample \u0026\u0026 objectExample.foo \u0026\u0026 objectExample.foo.bar \u0026\u0026 objectExample.foo.bar.example === 'Hello!') // anything...\n```\n\nIn this case, using a validator is better and safe.\n\n```js\n  if (Validator.isValid(objectExample, [['foo.bar.example', 'Hello!']])) // anything...\n```\n\nNow imagine validating multiple fields and values ​​from a single object in a old version of Node. Very tiring and verbose.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrbrunelli%2Fobject-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrbrunelli%2Fobject-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrbrunelli%2Fobject-validator/lists"}