{"id":15065376,"url":"https://github.com/rioam2/proxc","last_synced_at":"2026-02-18T17:31:20.367Z","repository":{"id":34242432,"uuid":"172807166","full_name":"rioam2/ProxC","owner":"rioam2","description":"🔗 Unlock the extensiblity of ES6 Proxy Objects in Javascript Classes and create beautiful APIs","archived":false,"fork":false,"pushed_at":"2023-01-05T05:51:56.000Z","size":389,"stargazers_count":1,"open_issues_count":17,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T10:16:48.371Z","etag":null,"topics":["api-wrapper","bracket-operator","functors","getters","index-operator","javascript","nodejs","npm-package","operator","overloading","setters","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/proxc","language":"TypeScript","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/rioam2.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":"2019-02-26T23:29:28.000Z","updated_at":"2020-03-25T18:25:21.000Z","dependencies_parsed_at":"2023-01-15T05:34:39.159Z","dependency_job_id":null,"html_url":"https://github.com/rioam2/ProxC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rioam2/ProxC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioam2%2FProxC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioam2%2FProxC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioam2%2FProxC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioam2%2FProxC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rioam2","download_url":"https://codeload.github.com/rioam2/ProxC/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioam2%2FProxC/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262003968,"owners_count":23243351,"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":["api-wrapper","bracket-operator","functors","getters","index-operator","javascript","nodejs","npm-package","operator","overloading","setters","typescript"],"created_at":"2024-09-25T00:37:34.793Z","updated_at":"2025-10-10T17:05:19.244Z","avatar_url":"https://github.com/rioam2.png","language":"TypeScript","readme":"\u003cimg src=\"assets/proxc_logo.png\" alt=\"ProxC Logo\" width=\"400\"\u003e\n\n[![Build Status](https://travis-ci.com/rioam2/ProxC.svg?branch=master)](https://travis-ci.com/rioam2/ProxC)\n[![Coverage Status](https://coveralls.io/repos/github/rioam2/ProxC/badge.svg?branch=master)](https://coveralls.io/github/rioam2/ProxC?branch=master)\n[![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)\n[![NPM Version](https://img.shields.io/npm/v/proxc.svg)](https://github.com/rioam2/bstjs)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://img.shields.io/badge/license-MIT-blue.svg)\n\nProxC is an NPM Package that allows you to create extensible classes and design declarative APIs that are a joy to use.\n\n## Motivation\n\nThis package was heavily inspired by C++. In C++, you can overload the functionality of basic operators used on a class. This offers a new level of extensibility for defining custom APIs for your class implementations that are often exclusive to more lower-level programming languages.\n\nIn Javascript, Proxy Objects allow you to intercept and define custom behavior for fundamental operations such as property lookup/access `[]`, assignment `=`, enumeration, and function invocation `()`. These can be used to design extensible ES6 classes that allow synthetic operator definition with functionality similar to that of operator overloading in languages such as C++.\n\nProxC aims to combine the functionality of ES6 Proxy Objects with the convenience Javascript Classes. No functionality is gained over using Proxy Objects, however, ProxC allows developers to stay away from convoluted implementation details and define customizable APIs that are both easier to use and maintain.\n\n## API Documentation\n\nBy extending ProxC in your class definition and defining the following member functions, you are able to design a fully custom interface for your API:\n\n- **\\_\\_invoke\\_\\_(`...args: any`) → `any`**\n\n  Defines custom behavior for the class invocation/call operator, `()`. Invoked whenever a class instance is called as a function and forwards all arguments. Context is bound to the current class instance enabling you to use `this` to refer to internal class state.\n\n  If not defined, and the class attempts to be invoked, a TypeError will be thrown.\n\n  _Example: `myClass(1,2)` calls `__invoke__(1,2)` on `myClass`._\n\n- **\\_\\_accessor\\_\\_(`key: number|string`) → `any`**\n\n  Defines custom behavior for the class 'get' operator, also known as the 'accessor' or 'index' operator (`[]` or `.`). Invoked when bracket notation or dot notation is used on a class instance and the supplied `key` is not a member of the current class implementation.\n\n  If not defined, default behavior is assumed and the class accessor operator will still work as expected.\n\n  _Example: `myClass['hello']` invokes `__accessor__('hello')` on `myClass` if and only if `myClass` does not contain a member named `hello` and `__accessor__` is implemented._\n\n- **\\_\\_iterator\\_\\_() → `any[]`**\n\n  Defines how the class should be treated as an iterable object. Should return an array of elements that can be yielded to `for..of` loops.\n\n  If not defined, and the class attempts to be iterated, a TypeError will be thrown.\n\n  _Example: `for (const elt of myClass) {...}` loops over the iterable returned by `__iterator__` on `myClass`._\n\n# Examples\n\n1.  [Circular Array Data Structure](examples/circularArray.js)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frioam2%2Fproxc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frioam2%2Fproxc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frioam2%2Fproxc/lists"}