{"id":15369095,"url":"https://github.com/developit/puredom-model","last_synced_at":"2026-04-07T07:02:18.628Z","repository":{"id":13000602,"uuid":"15679782","full_name":"developit/puredom-model","owner":"developit","description":"A synchronized model base class for puredom.","archived":false,"fork":false,"pushed_at":"2017-05-17T06:32:10.000Z","size":107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-31T08:54:37.785Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developit.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":"2014-01-06T17:06:41.000Z","updated_at":"2014-09-28T14:52:04.000Z","dependencies_parsed_at":"2022-08-28T09:40:56.725Z","dependency_job_id":null,"html_url":"https://github.com/developit/puredom-model","commit_stats":null,"previous_names":["developit/puredom.model"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/developit/puredom-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpuredom-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpuredom-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpuredom-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpuredom-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developit","download_url":"https://codeload.github.com/developit/puredom-model/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpuredom-model/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31503394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-01T13:34:08.663Z","updated_at":"2026-04-07T07:02:18.608Z","avatar_url":"https://github.com/developit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"puredom-model [![Version](https://img.shields.io/npm/v/puredom-model.svg?style=flat)](https://www.npmjs.org/package/puredom-model) ⎔ [![Build Status](https://img.shields.io/travis/developit/puredom-model.svg?style=flat\u0026branch=master)](https://travis-ci.org/developit/puredom-model) \n=============\n\nA synchronized model base class for puredom.\n\n\nUsage\n-----\n\n```JavaScript\n// Grab via browserify, AMD or \u003cscript\u003e:\nvar Model = require('puredom-model'),\n\t$ = require('puredom'),\n\tdb = new $.LocalStorage('babies');\n\n\n// Create a class that inherits from Model\nfunction Fox(attributesOrId, callback) {\n\tModel.call(this, attributesOrId, db, callback);\n}\n\n$.inherits(Fox, Model);\n\n$.extend(Fox.prototype, {\n\ttype : 'Fox',\n\turl : '/api/fox/{{id}}',\n\t\n\t/** Check if the fox is in posession of bacon */\n\thasBacon : function() {\n\t\treturn this.get('bacon') \u003e 0;\n\t},\n\t\n\t/** Give the fox some bacon */\n\tgiveBacon : function(amount) {\n\t\tvar bacon = this.get('bacon') || 0;\n\t\tthis.set('bacon', bacon + amount);\n\t}\n});\n\n\n// Create a new Fox:\nvar fox = new Fox({ bacon:0 }, function(err) {\n\tif (err) throw new Error(err);\n\t\n\t// set() and get() can be used synchronously after initialization:\n\tfox.set('xp', 42);\n\tfox.get('xp');\t\t// 42\n\t\n\t// Try out those accessor methods:\n\tfox.hasBacon();\t\t// false\n\tfox.giveBacon(1);\n\tfox.hasBacon();\t\t// true\n\t\n\t// Any set() or sync() call triggers a sync:\n\tfox.synced;\t\t\t// false\n\tfox.on('syncend', function() {\n\t\tfox.synced;\t\t// true\n\t});\n\t\n\t// Synchronization can also be done manually:\n\tfox.sync(function(err) {\n\t\t// saved\n\t});\n});\n\n\n// Work with an existing Fox:\nvar id = '24g08h275na';\n\n// Creating using an ID triggers a fetch() during initialization\nvar kit = new Fox(id, function(err) {\n\tif (err) throw new Error(err);\n\t\n\tkit.get('bacon');\t\t// 1\n\tkit.giveBacon(5);\n\tkit.get('bacon');\t\t// 6\n});\n```\n\n\nLicense\n-------\nThis plugin is available under the BSD-3-Clause License:\n\n\u003e\tCopyright (c) Jason Miller. All rights reserved.\n\u003e\t\n\u003e\tRedistribution and use in source and binary forms, with or without modification, \n\u003e\tare permitted provided that the following conditions are met:\n\u003e\t\n\u003e\t*\tRedistributions of source code must retain the above copyright notice, \n\u003e\t\tthis list of conditions and the following disclaimer.\n\u003e\t\n\u003e\t*\tRedistributions in binary form must reproduce the above copyright notice, \n\u003e\t\tthis list of conditions and the following disclaimer in the documentation \n\u003e\t\tand/or other materials provided with the distribution.\n\u003e\t\n\u003e\t*\tNeither the name of Jason Miller, nor the names of its contributors may be used to endorse \n\u003e\t\tor promote products derived from this software without specific prior written permission.\n\u003e\t\n\u003e\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS \n\u003e\tOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY \n\u003e\tAND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER \n\u003e\tOR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n\u003e\tDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \n\u003e\tDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER \n\u003e\tIN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n\u003e\tOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Fpuredom-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopit%2Fpuredom-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Fpuredom-model/lists"}