{"id":13701410,"url":"https://github.com/znck/prop-types","last_synced_at":"2025-04-14T21:53:20.509Z","repository":{"id":66141239,"uuid":"110070088","full_name":"znck/prop-types","owner":"znck","description":"Fluent prop validation for Vue","archived":false,"fork":false,"pushed_at":"2020-07-13T22:03:02.000Z","size":421,"stargazers_count":97,"open_issues_count":2,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T21:53:07.730Z","etag":null,"topics":["props","validation","vue"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/znck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2017-11-09T05:09:58.000Z","updated_at":"2022-01-02T06:38:23.000Z","dependencies_parsed_at":"2023-03-24T22:51:16.394Z","dependency_job_id":null,"html_url":"https://github.com/znck/prop-types","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fprop-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fprop-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fprop-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fprop-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znck","download_url":"https://codeload.github.com/znck/prop-types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968754,"owners_count":21191158,"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":["props","validation","vue"],"created_at":"2024-08-02T20:01:35.764Z","updated_at":"2025-04-14T21:53:20.491Z","avatar_url":"https://github.com/znck.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cdiv class=\"text-xs-center\" align=\"center\" style=\"margin: 20px\"\u003e\n  \u003cimg src=\"./logo.png\" height=\"255\" alt=\"prop-types\"\u003e\n\u003c/div\u003e\u003cbr\u003e\u003cbr\u003e\n\n\u003cdiv class=\"text-xs-center\" align=\"center\"\u003e\n\n  [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)\n  [![NPM version](https://img.shields.io/npm/v/@znck/prop-types.svg?style=flat)](https://npmjs.com/package/@znck/prop-types)\n  [![NPM downloads](https://img.shields.io/npm/dm/@znck/prop-types.svg?style=flat)](https://npmjs.com/package/@znck/prop-types)\n  [![CircleCI](https://circleci.com/gh/znck/prop-types/tree/master.svg?style=shield)](https://circleci.com/gh/znck/prop-types/tree/master)\n  [![codecov](https://codecov.io/gh/znck/prop-types/branch/master/graph/badge.svg)](https://codecov.io/gh/znck/prop-types)\n\n\u003c/div\u003e\n\n## Introduction\n\nFluent prop validation for Vue that won't land in your production code.\n\n\u003e Use [rollup-plugin-replace](https://github.com/rollup/rollup-plugin-replace) or [DefinePlugin](https://webpack.js.org/plugins/define-plugin/) to replace `process.env.NODE_ENV`  with `'production'`.  \n\u003e If you are using Vue CLI or Nuxt, it's already done for you.\n\n## Usage\n\n### Installation\n\n```shell\nnpm install --save @znck/prop-types\n```\n\n### Examples\n\n```js\nimport PropTypes from '@znck/prop-types'; // ES6\nvar PropTypes = require('@znck/prop-types'); // ES5 with npm\n```\n\nMake sure to add `@znck/prop-types/remove` to babel config.\n\n```js\n// babel.config.js or .babelrc.js\n...\n  plugins: [\n    '@znck/prop-types/remove'\n  ]\n...\n```\n\nHere is an example of using PropTypes with a Vue component, which also\ndocuments the different validators provided:\n\n\u003c!-- Example borrowed from facebook/prop-types --\u003e\n\n```vue\n\u003cscript\u003e\nimport PropTypes from 'prop-types';\n\nexport default {\n  props: {\n    // You can declare that a prop is a specific JS primitive. By default, these\n    // are all optional.\n    optionalArray: PropTypes.array,\n    optionalBool: PropTypes.bool,\n    optionalFunc: PropTypes.func,\n    optionalNumber: PropTypes.number,\n    optionalObject: PropTypes.object,\n    optionalString: PropTypes.string,\n    optionalSymbol: PropTypes.symbol,\n\n    // You can also declare that a prop is an instance of a class. This uses\n    // JS's instanceof operator.\n    optionalMessage: PropTypes.instanceOf(Message),\n\n    // You can ensure that your prop is limited to specific values by treating\n    // it as an enum.\n    optionalEnum: PropTypes.oneOf(['News', 'Photos']),\n\n    // An object that could be one of many types\n    optionalUnion: PropTypes.oneOfType([\n      PropTypes.string,\n      PropTypes.number,\n      PropTypes.instanceOf(Message)\n    ]),\n\n    // An array of a certain type\n    optionalArrayOf: PropTypes.arrayOf(PropTypes.number),\n\n    // An object with property values of a certain type\n    optionalObjectOf: PropTypes.objectOf(PropTypes.number),\n\n    // An object taking on a particular shape\n    optionalObjectWithShape: PropTypes.shape({\n      color: PropTypes.string,\n      fontSize: PropTypes.number\n    }),\n\n    // You can chain any of the above with `isRequired` to make sure a warning\n    // is shown if the prop isn't provided.\n    requiredFunc: PropTypes.func.isRequired,\n\n    // A value of any data type\n    requiredAny: PropTypes.any.isRequired,\n\n    // You can also supply a custom validator.\n    customArrayProp: PropTypes.string.validate(value =\u003e value === 'foo'),\n  }\n}\n\u003c/script\u003e\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/znck/prop-types/releases).\n\n## Author\n\n**prop-types** © [Rahul Kadyan](https://github.com/znck), Released under the [MIT](./LICENSE) License.\u003cbr\u003e\nAuthored and maintained by Rahul Kadyan with help from contributors ([list](https://github.com/znck/prop-types-temp/contributors)).\n\n\u003e [znck.me](https://znck.me) · GitHub [@Rahul Kadyan](https://github.com/znck) · Twitter [@znck0](https://twitter.com/@znck0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznck%2Fprop-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznck%2Fprop-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznck%2Fprop-types/lists"}