{"id":18470377,"url":"https://github.com/aliencreations/node-validator","last_synced_at":"2025-09-11T01:08:49.524Z","repository":{"id":99301806,"uuid":"310620450","full_name":"AlienCreations/node-validator","owner":"AlienCreations","description":"Validator for Alien Creations node apps.","archived":false,"fork":false,"pushed_at":"2024-03-30T16:24:19.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T11:58:13.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlienCreations.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":"2020-11-06T14:32:48.000Z","updated_at":"2022-05-31T22:19:00.000Z","dependencies_parsed_at":"2024-03-30T17:30:02.571Z","dependency_job_id":"21b24fa9-8935-48c4-a681-48edb8b583c1","html_url":"https://github.com/AlienCreations/node-validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlienCreations/node-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlienCreations%2Fnode-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlienCreations%2Fnode-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlienCreations%2Fnode-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlienCreations%2Fnode-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlienCreations","download_url":"https://codeload.github.com/AlienCreations/node-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlienCreations%2Fnode-validator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265810128,"owners_count":23831946,"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":[],"created_at":"2024-11-06T10:13:47.251Z","updated_at":"2025-07-18T18:34:15.441Z","avatar_url":"https://github.com/AlienCreations.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-validator\nValidator for Alien Creations node apps\n\n## Install\n\n```\n$ yarn add @aliencreations/node-validator\n```\n\n## Bundled Dependencies\n- [prettycats](https://github.com/seancannon/prettycats)\n- [jcvd](https://github.com/seancannon/jcvd)\n\n## Usage\n`validate` accepts two payloads - one is the schema and one is the payload. If the payload\ndoes not satisfy the schema, the function will throw an error. \n\nPlease see [node-error](https://github.com/aliencreations/node-error) for \na complete list of validation errors. \n\n```js\nconst {\n  isArrayOf,\n  isObjectOf,\n  isOptional,\n  isRequired,\n  label,\n  prr\n} = require('@aliencreations/node-validator');\n\n\nconst accountType = label('accountType', isObjectOf({\n  accountName   : isRequired(prr.isStringOfLengthAtMost(30)),\n  accountNumber : isRequired(prr.isPositiveNumber)\n}));\n\nconst validateUser = label('validateUser', isObjectOf({\n  firstName : isRequired(prr.isStringOfLengthAtMost(30)),\n  lastName  : isRequired(prr.isStringOfLengthAtMost(30)),\n  accounts  : isOptional(isArrayOf(accountType))\n}));\n\n// Example\ntry {\n  validateUser({ \n    firstName : 'Joe',\n    lastName  : 'Swanson',\n    accounts  : [\n      { \n        name   : 'My Main Account',\n        number : 12345\n      }\n    ]\n });\n} catch (e) {\n  // threw because accounts -\u003e [0] -\u003e name is unsupported, should have been accountName\n}\n\n```\n---\n## Changelog\n\n##### 1.0.0\n  - Initial commit\n\n##### 1.0.1\n  - Tree-shake\n  \n##### 1.0.2\n  - Update [jcvd](https://github.com/seancannon/jcvd) library\n\n##### 1.0.3\n  - Update [prettycats](https://github.com/seancannon/prettycats) library\n\n##### 1.0.4\n  - Update README\n\n##### 1.0.5\n  - Update [prettycats](https://github.com/seancannon/prettycats) library\n\n##### 1.0.6\n- Update README\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliencreations%2Fnode-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliencreations%2Fnode-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliencreations%2Fnode-validator/lists"}