{"id":50580154,"url":"https://github.com/codewithmark/dom","last_synced_at":"2026-06-05T01:02:51.234Z","repository":{"id":299008743,"uuid":"132043718","full_name":"codewithmark/dom","owner":"codewithmark","description":"Fastest way to manipulate json array data","archived":false,"fork":false,"pushed_at":"2025-07-09T03:55:38.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T04:34:32.990Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithmark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-03T20:02:38.000Z","updated_at":"2025-07-09T03:55:42.000Z","dependencies_parsed_at":"2025-06-14T05:43:33.510Z","dependency_job_id":null,"html_url":"https://github.com/codewithmark/dom","commit_stats":null,"previous_names":["codewithmark/dom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codewithmark/dom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmark%2Fdom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmark%2Fdom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmark%2Fdom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmark%2Fdom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithmark","download_url":"https://codeload.github.com/codewithmark/dom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmark%2Fdom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33926275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"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":"2026-06-05T01:02:48.373Z","updated_at":"2026-06-05T01:02:51.229Z","avatar_url":"https://github.com/codewithmark.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dom.js 🧩\n\nA lightweight, chainable JavaScript class for managing object arrays — like a tiny in-memory database with filtering, transforming, and localStorage support.\n\n---\n\n## 📦 Features\n\n- ✅ Fully **chainable** API (`add`, `update`, `remove`, etc.)\n- ✅ Works with **arrays of objects**\n- ✅ Filter, find, sort, map, and transform data\n- ✅ Easily **save/load** from `localStorage`\n- ✅ Schema-based **data validation**\n- ✅ Useful for state management, frontend tools, or browser apps\n  \n---\n\n## 🧪 Usage with Data, Functions \u0026 Output\n\n### ➕ Add Records\n\n```js\nconst users = new Dom();\n\nusers\n  .add({ id: 1, name: \"Alice\", role: \"admin\" })\n  .add([\n    { id: 2, name: \"Bob\", role: \"user\" },\n    { id: 3, name: \"Charlie\", role: \"guest\" }\n  ]);\n\nconsole.log(users.result());\n```\n\n📤 Output:\n\n```js\n[\n  { id: 1, name: \"Alice\", role: \"admin\" },\n  { id: 2, name: \"Bob\", role: \"user\" },\n  { id: 3, name: \"Charlie\", role: \"guest\" }\n]\n```\n\n---\n\n### ✏️ Update Record\n\n```js\nusers.update({ role: \"editor\" }, { id: 2 });\nconsole.log(users.find({ id: 2 }));\n```\n\n📤 Output:\n\n```js\n{ id: 2, name: \"Bob\", role: \"editor\" }\n```\n\n---\n\n### ❌ Remove Record\n\n```js\nusers.remove({ role: \"guest\" });\nconsole.log(users.result());\n```\n\n📤 Output:\n\n```js\n[\n  { id: 1, name: \"Alice\", role: \"admin\" },\n  { id: 2, name: \"Bob\", role: \"editor\" }\n]\n```\n\n---\n\n### 🔍 Find \u0026 Filter\n\n```js\nconsole.log(users.find({ name: \"Alice\" }));\nconsole.log(users.filter({ role: \"admin\" }));\n```\n\n📤 Output:\n\n```js\n{ id: 1, name: \"Alice\", role: \"admin\" }\n\n[\n  { id: 1, name: \"Alice\", role: \"admin\" }\n]\n```\n\n---\n\n### 🧠 Select Fields\n\n```js\nconsole.log(users.select([\"name\"]));\n```\n\n📤 Output:\n\n```js\n[\n  { name: \"Alice\" },\n  { name: \"Bob\" }\n]\n```\n\n---\n\n### 📈 Sort by Name\n\n```js\nusers\n  .add({ id: 4, name: \"Zara\", role: \"admin\" })\n  .sortBy(\"name\");\n\nconsole.log(users.result());\n```\n\n📤 Output:\n\n```js\n[\n  { id: 1, name: \"Alice\", role: \"admin\" },\n  { id: 2, name: \"Bob\", role: \"editor\" },\n  { id: 4, name: \"Zara\", role: \"admin\" }\n]\n```\n\n---\n\n### 🔄 Transform with `map()`\n\n```js\nusers.map(u =\u003e ({\n  ...u,\n  email: `${u.name.toLowerCase()}@example.com`\n}));\n\nconsole.log(users.result());\n```\n\n📤 Output:\n\n```js\n[\n  { id: 1, name: \"Alice\", role: \"admin\", email: \"alice@example.com\" },\n  { id: 2, name: \"Bob\", role: \"editor\", email: \"bob@example.com\" },\n  { id: 4, name: \"Zara\", role: \"admin\", email: \"zara@example.com\" }\n]\n```\n\n---\n\n### 💾 Save \u0026 Load from LocalStorage\n\n```js\nusers.save(\"users\");\n\nconst loaded = new Dom(\"users\");\nconsole.log(loaded.result());\n```\n\n📤 Output:\n\n```js\n[\n  { id: 1, name: \"Alice\", role: \"admin\", email: \"alice@example.com\" },\n  { id: 2, name: \"Bob\", role: \"editor\", email: \"bob@example.com\" },\n  { id: 4, name: \"Zara\", role: \"admin\", email: \"zara@example.com\" }\n]\n```\n\n---\n\n### 🧹 Clear All Data\n\n```js\nusers.clear();\nconsole.log(users.result());\n```\n\n📤 Output:\n\n```js\n[]\n```\n\n---\n\n### ✅ Validate Schema\n\n```js\nusers\n  .add({ id: \"oops\", name: null, role: 999 })\n  .validate({ id: \"number\", name: \"string\", role: \"string\" })\n  .log();\n```\n\n📤 Output:\n\n```js\n[\n  { id: 1, name: \"Alice\", role: \"admin\", email: \"alice@example.com\" },\n  { id: 2, name: \"Bob\", role: \"editor\", email: \"bob@example.com\" },\n  { id: 4, name: \"Zara\", role: \"admin\", email: \"zara@example.com\" }\n]\n```\n\n---\n\n## 📄 License\n\nMIT — Free for personal or commercial use.\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmark%2Fdom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithmark%2Fdom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmark%2Fdom/lists"}