{"bugs":{"url":"https://github.com/hapijs/joi/issues"},"dist":{"shasum":"12a2e9b3adff506cf75723ae2bf26bf1f5948697","tarball":"https://registry.npmjs.org/@hapi/joi/-/joi-16.0.0-rc1.tgz","fileCount":28,"integrity":"sha512-I64oEaDWZA4FKzEDnoadcqB7T+p/KdIFoWpaluxPIXwffgPYxGk3EIrPVLsx6JPKzdzWgEZcCe/xni0RVF3PxA==","signatures":[{"sig":"MEQCIAak0F74f4+kIl3e4ZBBtt/QWXooCzI/ujeQam1/K1WDAiAeNzcW5nnZSQNmFPYcsafVxET2OUqHABHqyc5HYN7tIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196178,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdAAK9CRA9TVsSAnZWagAA++IQAIpTDTdS2TD6flkCuOvk\nvkDC6Xv0lHLMEebS9GZmQLG4Y/XoUXWyYtXbds9fGExKwA5MQDxzrtf7OZ8e\nimfxMrDb43/Gi8q2FWsG36GS+hokXdd1rfTcJf6C6spDrj2W3O0eJiPHcolN\nB9Xl8pgy8Ok6umOS+sgLfujr3JXN3K+vcGdre0SdOvfDMWtuNq0UB9o9/ITz\novdkgCdKdECgj7uaQV00VQeaE6O0adqCJzFP6sa6Nz1jS9gbuxZ23AVUfLp4\nauC0I+ihTHPUcJA3hFlZyn61f3+WXkq4aHNT2rmYCkpJJmbIADMjs4FRPLvz\nziZhWRjEKWQ8VePw7sHbXVh16gyq+WYLEf0xImAdNnUXSmNSlMg9gvFP7nNF\nwfmzpzpa0qXFPGmUfYu+3HUPy9DCcsoujMJXUdXIn4egcNOy5aAKkw86ve4C\nT8EKrCG3T5iashaPg+OMJuEkypxkD7jcpUvg9Kvyz633tHC93y8uLeAwwgYj\nUckF9Aou1ltavopoeCwMFb0lq6xzKOiICVkdXktcywCs6JJIu6DuV2IFr4G0\nnbb+55bEoUzKYCx7tXVnO/hccHNkpOZIo4uXUYBwD9sqnkpB5vwG3ptBwmKH\nxfd0CiYzGUfyUp3Bv7l0Qtj6NdtGSVCws8n2/ApoptheDQNW+6LC8Wgw4nue\ndVnY\r\n=RH8P\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","name":"@hapi/joi","readme":"<a href=\"http://hapijs.com\"><img src=\"https://raw.githubusercontent.com/hapijs/assets/master/images/family.png\" width=\"180px\" align=\"right\" /></a>\n\n# joi\n\nObject schema description language and validator for JavaScript objects.\n\n[![Build Status](https://travis-ci.org/hapijs/joi.svg?branch=master)](https://travis-ci.org/hapijs/joi)\n\n## Introduction\n\nImagine you run facebook and you want visitors to sign up on the website with real names and not something like `l337_p@nda` in the first name field. How would you define the limitations of what can be inputted and validate it against the set rules?\n\nThis is joi, joi allows you to create *blueprints* or *schemas* for JavaScript objects (an object that stores information) to ensure *validation* of key information.\n\n# Installation\n\n```cli \n npm install --save @hapi/joi\n ```\n\n## API\nSee the detailed [API Reference](https://github.com/hapijs/joi/blob/v16.0.0-rc1/API.md).\n\n## Example\n\n```javascript\nconst Joi = require('@hapi/joi');\n\nconst schema = Joi.object().keys({\n    username: Joi.string().alphanum().min(3).max(30).required(),\n    password: Joi.string().regex(/^[a-zA-Z0-9]{3,30}$/),\n    access_token: [Joi.string(), Joi.number()],\n    birthyear: Joi.number().integer().min(1900).max(2013),\n    email: Joi.string().email({ minDomainSegments: 2 })\n}).with('username', 'birthyear').without('password', 'access_token');\n\n// Return result.\nconst result = Joi.validate({ username: 'abc', birthyear: 1994 }, schema);\n// result.error === null -> valid\n\n// You can also pass a callback which will be called synchronously with the validation result.\nJoi.validate({ username: 'abc', birthyear: 1994 }, schema, function (err, value) { });  // err === null -> valid\n\n```\n\nThe above schema defines the following constraints:\n* `username`\n    * a required string\n    * must contain only alphanumeric characters\n    * at least 3 characters long but no more than 30\n    * must be accompanied by `birthyear`\n* `password`\n    * an optional string\n    * must satisfy the custom regex\n    * cannot appear together with `access_token`\n* `access_token`\n    * an optional, unconstrained string or number\n* `birthyear`\n    * an integer between 1900 and 2013\n* `email`\n    * a valid email address string\n    * must have two domain parts e.g. `example.com`\n\n## Usage\n\nUsage is a two steps process. First, a schema is constructed using the provided types and constraints:\n\n```javascript\nconst schema = {\n    a: Joi.string()\n};\n```\n\nNote that **joi** schema objects are immutable which means every additional rule added (e.g. `.min(5)`) will return a\nnew schema object.\n\nSecond, the value is validated against the defined schema:\n\n```javascript\nconst {error, value} = Joi.validate({ a: 'a string' }, schema);\n\n// or\n\nJoi.validate({ a: 'a string' }, schema, function (error, value) { });\n```\n\nIf the input is valid, then the `error` will be `null`, otherwise it will be an `Error` object providing more information.\n\nThe schema can be a plain JavaScript object where every key is assigned a **joi** type, or it can be a **joi** type directly:\n\n```javascript\nconst schema = Joi.string().min(10);\n```\n\nIf the schema is a **joi** type, the `schema.validate(value, callback)` can be called directly on the type. When passing a non-type schema object,\nthe module converts it internally to an object() type equivalent to:\n\n```javascript\nconst schema = Joi.object().keys({\n    a: Joi.string()\n});\n```\n\nWhen validating a schema:\n\n* Values (or keys in case of objects) are optional by default.\n\n    ```javascript\n    Joi.validate(undefined, Joi.string()); // validates fine\n    ```\n\n    To disallow this behavior, you can either set the schema as `required()`, or set `presence` to `\"required\"` when passing `options`:\n\n    ```javascript\n    Joi.validate(undefined, Joi.string().required());\n    // or\n    Joi.validate(undefined, Joi.string(), /* options */ { presence: \"required\" });\n    ```\n\n* Strings are utf-8 encoded by default.\n* Rules are defined in an additive fashion and evaluated in order, first the inclusive rules, then the exclusive rules.\n\n## Browsers\n\nJoi doesn't directly support browsers, but you could use [joi-browser](https://github.com/jeffbski/joi-browser) for an ES5 build of Joi that works in browsers, or as a source of inspiration for your own builds.\n","gitHead":"532abb24af6d80fd759c980a94e5005a7d122e30","license":"BSD-3-Clause","scripts":{"toc":"hapitoc && node docs/check-errors-list.js","test":"lab -t 100 -a @hapi/code -L","version":"npm run toc && git add API.md README.md","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"_npmUser":{"name":"hueniverse","email":"eran@hammer.io"},"homepage":"https://github.com/hapijs/joi","keywords":["schema","validation"],"deprecated":"This version has been deprecated","repository":{"url":"git://github.com/hapijs/joi.git","type":"git"},"_npmVersion":"6.9.0","description":"Object schema validation","directories":{},"maintainers":[{"name":"hueniverse","email":"eran@hammer.io"},{"name":"marsup","email":"nicolas@morel.io"}],"_nodeVersion":"10.15.3","dependencies":{"@hapi/hoek":"7.x.x","@hapi/topo":"3.x.x","@hapi/marker":"1.x.x","@hapi/address":"2.x.x"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"hapitoc":"1.x.x","@hapi/lab":"19.x.x","@hapi/code":"5.x.x"},"_npmOperationalInternal":{"tmp":"tmp/joi_16.0.0-rc1_1560281789259_0.5297381693406269","host":"s3://npm-registry-packages"},"_id":"@hapi/joi@16.0.0-rc1","version":"16.0.0-rc1"}