{"id":13555889,"url":"https://github.com/codemix/modeling","last_synced_at":"2025-08-14T05:07:21.558Z","repository":{"id":17710943,"uuid":"20524682","full_name":"codemix/modeling","owner":"codemix","description":"Fast and flexible data models for node.js and the browser.","archived":false,"fork":false,"pushed_at":"2014-11-30T20:05:44.000Z","size":224,"stargazers_count":15,"open_issues_count":2,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-27T15:03:13.338Z","etag":null,"topics":[],"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/codemix.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-06-05T12:48:58.000Z","updated_at":"2023-09-08T16:48:04.000Z","dependencies_parsed_at":"2022-08-31T00:01:03.828Z","dependency_job_id":null,"html_url":"https://github.com/codemix/modeling","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/codemix/modeling","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmodeling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmodeling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmodeling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmodeling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemix","download_url":"https://codeload.github.com/codemix/modeling/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmodeling/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270364971,"owners_count":24571423,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T12:03:29.271Z","updated_at":"2025-08-14T05:07:21.464Z","avatar_url":"https://github.com/codemix.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"# Modeling\n\n[![Build Status](https://travis-ci.org/codemix/modeling.svg?branch=master)](https://travis-ci.org/codemix/modeling)\n\n\n# Usage\n\n```js\nvar Modeling = require('modeling');\n\nvar Thing = Modeling(\"Thing\", {\n  name: {\n    label: 'Name',\n    description: 'The name of the item',\n    type: 'string',\n    rules: [\n      ['required']\n    ]\n  },\n  description: {\n    label: 'Description',\n    description: 'A short description of the item.',\n    type: 'string',\n    rules: [\n      {name: 'length', max: 255}\n    ]\n  },\n  url: {\n    label: 'URL',\n    description: 'A URL identifiying the item.',\n    type: 'string',\n    rules: [\n      ['url']\n    ]\n  }\n});\n\nvar Person = Thing.extend(\"Person\", {\n  dateOfBirth: {\n    label: 'Date of Birth',\n    description: \"The person's date of birth.\",\n    type: Date,\n    rules: [\n      ['date']\n    ]\n  },\n  age: {\n    label: 'Age',\n    description: \"The person's age.\",\n    type: Number,\n    get: function () {\n      var birthday = this.dateOfBirth;\n      if (!birthday) {\n        return false;\n      }\n      var ageDifMs = Date.now() - birthday.getTime();\n      var ageDate = new Date(ageDifMs); // miliseconds from epoch\n      return Math.abs(ageDate.getFullYear() - 1970);\n    }\n  }\n});\n\nvar person = new Person({\n  name: 'Bob',\n  url: 'http://codemix.com/',\n  dateOfBirth: '1980-01-01'\n});\n\nconsole.log(person.age);\n\nconsole.log(JSON.stringify(person, null, 2));\n\n```\n\n# Installation\n\nVia [npm](https://npmjs.org/package/modeling):\n\n    npm install --save modeling\n\n\nor [bower](http://bower.io/search/?q=modeling):\n\n\n    bower install --save modeling\n\n\n\n# Running the tests\n\nFirst, `npm install`, then `npm test`. Code coverage generated with `npm run coverage`.\n\n\n# License\n\nMIT, see [LICENSE.md](LICENSE.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fmodeling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemix%2Fmodeling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fmodeling/lists"}