{"id":13602393,"url":"https://github.com/tj/node-delegates","last_synced_at":"2025-04-05T18:09:41.708Z","repository":{"id":13186710,"uuid":"15870218","full_name":"tj/node-delegates","owner":"tj","description":"Nodejs method and accessor delegation utility","archived":false,"fork":false,"pushed_at":"2020-02-25T14:04:19.000Z","size":17,"stargazers_count":433,"open_issues_count":12,"forks_count":56,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T17:11:10.897Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tj.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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-13T14:20:04.000Z","updated_at":"2025-03-26T05:09:05.000Z","dependencies_parsed_at":"2022-08-07T07:01:06.249Z","dependency_job_id":null,"html_url":"https://github.com/tj/node-delegates","commit_stats":null,"previous_names":["visionmedia/node-delegates"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fnode-delegates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fnode-delegates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fnode-delegates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fnode-delegates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tj","download_url":"https://codeload.github.com/tj/node-delegates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378149,"owners_count":20929297,"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":[],"created_at":"2024-08-01T18:01:22.059Z","updated_at":"2025-04-05T18:09:41.675Z","avatar_url":"https://github.com/tj.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\n# delegates\n\n  Node method and accessor delegation utilty.\n\n## Installation\n\n```\n$ npm install delegates\n```\n\n## Example\n\n```js\nvar delegate = require('delegates');\n\n...\n\ndelegate(proto, 'request')\n  .method('acceptsLanguages')\n  .method('acceptsEncodings')\n  .method('acceptsCharsets')\n  .method('accepts')\n  .method('is')\n  .access('querystring')\n  .access('idempotent')\n  .access('socket')\n  .access('length')\n  .access('query')\n  .access('search')\n  .access('status')\n  .access('method')\n  .access('path')\n  .access('body')\n  .access('host')\n  .access('url')\n  .getter('subdomains')\n  .getter('protocol')\n  .getter('header')\n  .getter('stale')\n  .getter('fresh')\n  .getter('secure')\n  .getter('ips')\n  .getter('ip')\n```\n\n# API\n\n## Delegate(proto, prop)\n\nCreates a delegator instance used to configure using the `prop` on the given\n`proto` object. (which is usually a prototype)\n\n## Delegate.auto(proto, targetProto, targetProp)\n\nDelegates getters, setters, values, and methods from targetProto to proto.\nAssumes that targetProto objects will exist under proto objects with the key targetProp.\n\n## Delegate#method(name)\n\nAllows the given method `name` to be accessed on the host.\n\n## Delegate#getter(name)\n\nCreates a \"getter\" for the property with the given `name` on the delegated\nobject.\n\n## Delegate#setter(name)\n\nCreates a \"setter\" for the property with the given `name` on the delegated\nobject.\n\n## Delegate#access(name)\n\nCreates an \"accessor\" (ie: both getter *and* setter) for the property with the\ngiven `name` on the delegated object.\n\n## Delegate#fluent(name)\n\nA unique type of \"accessor\" that works for a \"fluent\" API. When called as a\ngetter, the method returns the expected value. However, if the method is called\nwith a value, it will return itself so it can be chained. For example:\n\n```js\ndelegate(proto, 'request')\n  .fluent('query')\n\n// getter\nvar q = request.query();\n\n// setter (chainable)\nrequest\n  .query({ a: 1 })\n  .query({ b: 2 });\n```\n\n# License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj%2Fnode-delegates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftj%2Fnode-delegates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj%2Fnode-delegates/lists"}