{"id":16515631,"url":"https://github.com/insin/chainable-check","last_synced_at":"2025-09-21T00:31:29.377Z","repository":{"id":24563861,"uuid":"27971186","full_name":"insin/chainable-check","owner":"insin","description":"Create React.PropTypes-alike validators with an isRequired property","archived":false,"fork":false,"pushed_at":"2014-12-13T19:37:26.000Z","size":124,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-03T02:15:33.758Z","etag":null,"topics":["proptypes","react","utility","validation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-13T19:23:48.000Z","updated_at":"2019-03-17T09:22:26.000Z","dependencies_parsed_at":"2022-09-01T00:24:51.178Z","dependency_job_id":null,"html_url":"https://github.com/insin/chainable-check","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Fchainable-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Fchainable-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Fchainable-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Fchainable-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insin","download_url":"https://codeload.github.com/insin/chainable-check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233696351,"owners_count":18715777,"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":["proptypes","react","utility","validation"],"created_at":"2024-10-11T16:17:45.939Z","updated_at":"2025-09-21T00:31:24.060Z","avatar_url":"https://github.com/insin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## `chainableCheck()` [![travis status](https://secure.travis-ci.org/insin/chainable-check.png)](http://travis-ci.org/insin/chainable-check)\n\nWraps a custom validation function with the same requiredness behaviour as\nReact's [`React.PropTypes`](http://facebook.github.io/react/docs/reusable-components.html#prop-validation)\nvalidators.\n\nThat is: the validaton function will not be called if the value it's supposed to\nvalidate isn't given (or is `null`), and the function will have an\n`.isRequired` property, which is a validation function which will return an\n`Error` if the value isn't given (or is `null`).\n\nThis is effectively just a standalone version of React's internal\n`createChainableTypeChecker()` function from `ReactPropTypes.js`.\n\n## Install\n\n### Node.js\n\n`chainableCheck()` can be used on the server, or bundled for the client using an\nnpm-compatible packaging system such as [Browserify](http://browserify.org/) or\n[webpack](http://webpack.github.io/).\n\n```\nnpm install --save chainable-check\n```\n\n### Browser bundle\n\nThe browser bundle exposes a global `chainableCheck` variable.\n\nYou can find it in the [/dist directory](https://github.com/insin/chainable-check/tree/master/dist).\n\n## Usage\n\n```javascript\nvar chainableCheck = require('chainable-check')\n\nvar isEven = chainableCheck(function(props, propName, componentName, location) {\n  var value = props[propName]\n  if (isNaN(parseFloat(value)) || !isFinite(value) || parseFloat(value) % 2 !== 0) {\n    return new Error(\n      `Invalid ${locationName} \\`${propName}\\` supplied to ` +\n      `\\`${componentName}\\`, expected an even number.`\n    )\n  }\n})\n\nvar ExampleComponent = React.createClass({\n  propTypes: {\n    evenNumber: isEven\n  , requiredEvenNumber: isEven.isRequired\n  },\n\n  // ...\n})\n```\n\n### MIT Licensed","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsin%2Fchainable-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsin%2Fchainable-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsin%2Fchainable-check/lists"}