{"id":18052967,"url":"https://github.com/izumisy/validatable-record","last_synced_at":"2025-03-27T22:33:41.155Z","repository":{"id":47856451,"uuid":"101634047","full_name":"IzumiSy/validatable-record","owner":"IzumiSy","description":"Immutable.js Record powered with validate.js","archived":true,"fork":false,"pushed_at":"2024-06-11T01:53:30.000Z","size":505,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-19T13:38:13.697Z","etag":null,"topics":["immutablejs","record","validate-js","validation"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/validatable-record","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/IzumiSy.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":"2017-08-28T10:59:24.000Z","updated_at":"2025-01-20T07:00:13.000Z","dependencies_parsed_at":"2023-01-31T18:32:20.993Z","dependency_job_id":null,"html_url":"https://github.com/IzumiSy/validatable-record","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzumiSy%2Fvalidatable-record","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzumiSy%2Fvalidatable-record/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzumiSy%2Fvalidatable-record/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzumiSy%2Fvalidatable-record/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IzumiSy","download_url":"https://codeload.github.com/IzumiSy/validatable-record/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245937108,"owners_count":20696948,"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":["immutablejs","record","validate-js","validation"],"created_at":"2024-10-30T23:13:53.243Z","updated_at":"2025-03-27T22:33:40.839Z","avatar_url":"https://github.com/IzumiSy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# validatable-record\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/IzumiSy/validatable-record/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/IzumiSy/validatable-record/tree/master)\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n[![npm version](https://badge.fury.io/js/validatable-record.svg)](https://badge.fury.io/js/validatable-record)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\n\u003e Immutable.js Record powered with validate.js\n\n## Table of Contents\n- [Install](README.md#Install)\n- [Usage](README.md#Usage)\n- [Contribute](README.md#Contribute)\n- [Test](README.md#Test)\n- [License](README.md#License)\n\n## Install\n```bash\n$ npm install --save validatable-record\n```\n\n## Usage\nValidatableRecord returns `Record` in Immutable.js for extending your own class. Usage is almost the same as `Record` in Immutable.js, but it has the power of `validate.js`. With ValidatableRecord, you can define models with built-in validation logic.\n```js\nconst ManRecord = ValidatableRecord({\n  name: null,\n  age: null\n}, {\n  name: {\n    presence: true\n  },\n  age: {\n    presence: {\n      message: \"is invalid\"\n    }\n  }\n});\n\nclass Man extends ManRecord {\n  ...\n}\n\nconst man = new Man({\n  name: \"Justine\";\n  age: 25\n});\n\nman.validate() // == true\n\n// Of course you can use `Immutable.Record` methods\nman.size        // 2\nman.get('name') // \"Justine\"\nman.get('age')  // 25\n\nconst agelessMan = new Man({\n  name: \"Michael\"\n});\n\nagelessMan.validate() // == false\n\nagelessMan.getErrors() // == [ \"Age is invalid\" ]\n\n// You can set your own error to model\nagelessMan.setError(\"Unknown error\")\n\nagelessMan.getErrors() // = [ \"Unknown error\" ]\n```\n\n## Test\n```bash\n$ npm test\n```\n\n## Contribute\nPRs accepted.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizumisy%2Fvalidatable-record","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizumisy%2Fvalidatable-record","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizumisy%2Fvalidatable-record/lists"}