{"id":22930094,"url":"https://github.com/serebano/bitbox","last_synced_at":"2025-04-01T16:45:51.869Z","repository":{"id":91365353,"uuid":"82376158","full_name":"serebano/bitbox","owner":"serebano","description":"bitbox(...)","archived":false,"fork":false,"pushed_at":"2017-08-14T09:19:49.000Z","size":869,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-11T01:57:25.681Z","etag":null,"topics":["bitbox","components","observable","state"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serebano.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-18T09:32:10.000Z","updated_at":"2017-06-30T07:11:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9cc0cfb-156a-4911-91f7-4b6c4b2bedf4","html_url":"https://github.com/serebano/bitbox","commit_stats":{"total_commits":108,"total_committers":1,"mean_commits":108.0,"dds":0.0,"last_synced_commit":"3bca8d7078eca40ec32f654fe5f37d7b72f05d60"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serebano%2Fbitbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serebano%2Fbitbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serebano%2Fbitbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serebano%2Fbitbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serebano","download_url":"https://codeload.github.com/serebano/bitbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246673340,"owners_count":20815548,"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":["bitbox","components","observable","state"],"created_at":"2024-12-14T10:20:31.831Z","updated_at":"2025-04-01T16:45:51.845Z","avatar_url":"https://github.com/serebano.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bitbox\n\n```js\n// create observable app box\nconst app = bitbox(observable)\n\n// some helpers\nconst inc = count =\u003e count + 1 // increment operator\nconst set = (box, value) =\u003e obj =\u003e bitbox.set(obj, box, value) // setter factory\n\n// target object\nconst obj = {\n\tname: 'bitbox',\n\tcount: 0\n}\n\n// mapping\nconst map = bitbox({\n\tcount: app.count,\n\tname: app.name(name =\u003e name.toUpperCase())\n})\n\n// connect with target\nconst props = map(obj)\n\n// observe changes to mapped props\nobserve(() =\u003e console.log(`${props.name} - count(${props.count})`))\n\n// set / classic\napp(obj).count++\n// use operator\napp.count(obj, app.count(inc))\n\n\n// using handler / set(target, box/path, value)\nbitbox.set(obj, app.count, 10)\nbitbox.set(obj, app.count, app.count(inc))\n\n// array path\nbitbox.set(obj, ['app', 'count'], ['app', 'count', inc])\n\n// factory\nset(app.name, `Demo App`) // -\u003e (obj)\n\n// conditional\nset(app.name, app.count(n =\u003e n \u003e 10 ? `Foo` : `Bar`))\n\n// select...\napp(JSON.stringify, console.log, obj)\n\n```\n\n```\nyarn start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserebano%2Fbitbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserebano%2Fbitbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserebano%2Fbitbox/lists"}