{"id":16178360,"url":"https://github.com/munrocket/overload-bracket","last_synced_at":"2025-03-19T01:30:47.620Z","repository":{"id":95974821,"uuid":"141345769","full_name":"munrocket/overload-bracket","owner":"munrocket","description":"Overloading square bracket operator [] in javascript and other array methods to any object with container using es6 proxy.","archived":false,"fork":false,"pushed_at":"2019-01-31T09:24:03.000Z","size":16,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T01:35:09.794Z","etag":null,"topics":["array-like","brackets","es6","meta","meta-programming","overload","proxy","pseudo-array"],"latest_commit_sha":null,"homepage":"","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/munrocket.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":"2018-07-17T21:32:53.000Z","updated_at":"2024-02-25T03:07:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8641f64-7c97-4685-8cd4-48c624581b77","html_url":"https://github.com/munrocket/overload-bracket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Foverload-bracket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Foverload-bracket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Foverload-bracket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Foverload-bracket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/munrocket","download_url":"https://codeload.github.com/munrocket/overload-bracket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244336111,"owners_count":20436770,"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":["array-like","brackets","es6","meta","meta-programming","overload","proxy","pseudo-array"],"created_at":"2024-10-10T05:13:35.618Z","updated_at":"2025-03-19T01:30:47.342Z","avatar_url":"https://github.com/munrocket.png","language":"JavaScript","readme":"Overload bracket\n=========\n\nOverloading square bracket operator [] and other array methods to any object with container using es6 proxy.\n\n### Disclamer\n\nThis project was just for fun, use it as a reference for your own proxy.\n\n### Use cases\n\nWith this library you can forget about creating new arrays and keep your code clean. For example you have an object with points container \nand you trying to iterate through X values. You can create ObjectHandler of X points and manipulate X data inside object like in array. This is helpfull when you use charting libraries and when you fetching data from server.\n```javascript\nlet obj = { points : [{x: 1, y: 2}, {x: 10, y: 20}, {x: -1, y: -2}]};\nlet x = new ObjectHandler(\n  obj,                                        //target object\n  p =\u003e p.points,                              //target array\n  p =\u003e p.x,                                   //getter\n  (p, v) =\u003e p.x = v                           //setter\n);\nlet mean = (x[0] + x[1] + x[2]) / x.length(); //calculate (1 + 10 - 1) / 3\nx.map(x =\u003e x*x);                              //map array to [1, 100, 1]\nconsole.log(x.join(\", \"));                    //console.log(\"1, 10, -1\");\n```\n\n### Installation\n\nIf you use new node.js or modern browsers just install npm package `npm i overload-bracket` or run command `npm run build:browser` to build script for web page. With es5 environment you need to think about babel, babel-proxy-plugin or harmony-reflect.\n\n### Contributing\n\nFeel free to contribute.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmunrocket%2Foverload-bracket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmunrocket%2Foverload-bracket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmunrocket%2Foverload-bracket/lists"}