{"id":13609663,"url":"https://github.com/talyssonoc/structure","last_synced_at":"2025-04-04T09:09:28.123Z","repository":{"id":11905516,"uuid":"70779496","full_name":"talyssonoc/structure","owner":"talyssonoc","description":"A simple schema/attributes library built on top of modern JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-06T01:56:07.000Z","size":2258,"stargazers_count":301,"open_issues_count":34,"forks_count":20,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-30T02:35:54.471Z","etag":null,"topics":["coercion","domain-entity","javascript","model","schema","validation"],"latest_commit_sha":null,"homepage":"https://structure.js.org/","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/talyssonoc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-13T07:15:19.000Z","updated_at":"2024-09-04T17:49:26.000Z","dependencies_parsed_at":"2023-01-13T17:45:09.902Z","dependency_job_id":null,"html_url":"https://github.com/talyssonoc/structure","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talyssonoc%2Fstructure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talyssonoc%2Fstructure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talyssonoc%2Fstructure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talyssonoc%2Fstructure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/talyssonoc","download_url":"https://codeload.github.com/talyssonoc/structure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149502,"owners_count":20891954,"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":["coercion","domain-entity","javascript","model","schema","validation"],"created_at":"2024-08-01T19:01:36.928Z","updated_at":"2025-04-04T09:09:28.103Z","avatar_url":"https://github.com/talyssonoc.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# \u003ca href=\"https://structure.js.org/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/talyssonoc/structure/master/structure.jpg\" width=\"300\"\u003e\u003c/a\u003e\n\n## A simple schema/attributes library built on top of modern JavaScript\n\nStructure provides a simple interface which allows you to add attributes to your classes based on a schema, with validations and type coercion.\n\n## Packages\n\n- [Structure](packages/structure)\n- [jest-structure](packages/jest-structure)\n\n## [Documentation](https://structure.js.org/)\n\n## Example Structure usage\n\nFor each attribute on your schema, a getter and a setter will be created into the given class. It'll also auto-assign those attributes passed to the constructor.\n\n```js\nconst { attributes } = require('structure');\n\nconst User = attributes({\n  name: String,\n  age: {\n    type: Number,\n    default: 18,\n  },\n  birthday: Date,\n})(\n  class User {\n    greet() {\n      return `Hello ${this.name}`;\n    }\n  }\n);\n\nconst user = new User({\n  name: 'John Foo',\n});\n\nuser.name; // 'John Foo'\nuser.greet(); // 'Hello John Foo'\n```\n\n## [Contributing](contributing.md)\n\n## [LICENSE](license.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalyssonoc%2Fstructure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftalyssonoc%2Fstructure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalyssonoc%2Fstructure/lists"}