{"maintainers":[{"name":"anonymous","email":"jonathan@jclem.net"}],"dist-tags":{"latest":"1.0.0"},"author":{"name":"Jonathan Clem"},"description":"A path proxy object constructor","readme":"# path-proxy\n\nGiven an group of paths (say, from an API schema), you might need to create a\nset of proxy objects for interacting with those paths. This is the situation I\nfound myself in while working on the [Node client for the Heroku API][heroku_client].\n\nGiven a set of paths and a base constructor function, path-proxy will create a\nnetwork of logical proxy objects based on the paths and attach it to the\nconstructor's prototype.\n\n## Install\n\n```sh\nnpm install path-proxy --save\n```\n\n## Usage\n\n```javascript\nvar pathProxy = require('path-proxy');\n\nfunction ApiClient() {}\n\npathProxy.proxy(ApiClient, [\n  \"/foo\",\n  \"/foo/{id}/bar\"\n]);\n\nvar client = new ApiClient();\nclient.foo(\"qux\").bar();\n```\n\nThis may not appear all that useful—they're mostly just empty functions—until you\nstart mucking around with their prototypes:\n\n```javascript\nvar BarProxy = pathProxy.pathProxy(ApiClient, \"/foo/{id}/bar\");\nBarProxy.prototype.sayHello = function () {\n  console.log(\"hello\");\n};\n\nclient.foo(\"qux\").bar().sayHello(); // Logs \"hello\".\n```\n\nThey also have access to a few useful attributes:\n\n```javascript\nvar baz = client.foo(\"qux\").bar(\"baz\");\nbaz.params;       // [\"qux\", \"baz\"]\nbaz.pathSegments; // [\"foo\", \"qux\", \"bar\", \"baz\"]\nbaz.path;         // \"/foo/qux/bar/baz\"\n```\n\nAnd can access the instance of the base constructor they're based off of:\n\n```javascript\nApiClient.prototype.delete = function (path, callback) {\n  var message = this.name + \" deleted at \" + path;\n  callback(message);\n};\n\nvar client = new ApiClient();\nclient.name = \"Jonathan\";\n\nBarProxy.prototype.delete = function (callback) {\n  this.base.delete(this.path, callback);\n};\n\n// This:\nclient.foo(\"qux\").bar(\"baz\").delete(function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n\n// Is equivalent to this:\nclient.delete(\"/foo/qux/bar/baz\", function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n```\n\n## Tests\n\npath-proxy uses jasmine-node for tests. To run them:\n\n```sh\n$ npm install\n$ npm test\n```\n\n[heroku_client]: https://github.com/heroku/node-heroku-client\n","repository":{"type":"git","url":"https://github.com/jclem/path-proxy"},"users":{"zeke":true},"versions":{"0.0.0":{"name":"path-proxy","version":"0.0.0","description":"A path proxy object constructor","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/jclem/path-proxy"},"keywords":["node","proxy"],"author":{"name":"Jonathan Clem"},"license":"MIT","bugs":{"url":"https://github.com/jclem/path-proxy/issues"},"dependencies":{"inflection":"~1.3.0"},"readme":"# path-proxy\n\npath-proxy is based on my work on the [Node client for the Heroku API][heroku_client].\nIts purpose is to, given a base constructor function and an array of paths (most\nlikely for an API), build a network of proxy object constructors on top of that\nbase constructor.\n\n## Example:\n\n```javascript\nvar pathProxy = require('path-proxy');\n\nfunction Client () {\n}\n\nClient.prototype.sayHello = function () {\n  return \"hello\";\n}\n\npathProxy.proxy(Client, [\n  \"/foo\",\n  \"/foo/{id}/bar\",\n  \"/foo/{id}/bar/{id}/baz\"\n]);\n\nvar client = new Client(),\n    baz    = client.foo(\"a\").bar(\"b\").baz();\n\n// `baz` is a proxy object for \"/foo/a/bar/b/baz\". It also has access to\n// `client` through its `base` parameter.\nbaz.params;          // [\"a\", \"b\"]\nbaz.path;            // \"/foo/a/bar/b/baz\"\nbaz.base.sayHello(); // \"hello\"\n```\n\nProxy constructor functions can also be fetched individually:\n\n```javascript\nvar qux = pathProxy.pathProxy(Client, \"/qux\");\n\nqux.prototype.foo = function () {\n  return \"foo\";\n}\n\nclient.qux().foo(); // \"foo\"\n```\n\nNote that **this project is still extremely unstable**. As in, don't be surprised\nat awful things like force-pushes to master.\n\n[heroku_client]: https://github.com/heroku/node-heroku-client\n","readmeFilename":"README.md","_id":"path-proxy@0.0.0","dist":{"shasum":"a367f935d635f907cb6f4f844252b0a4609b4d9f","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/path-proxy/-/path-proxy-0.0.0.tgz","integrity":"sha512-ywtP/Ac344dVXLdvY2KUp9goAZHJIx8M/26oMSB1isxn4MOw6paQdIhOYsU0En0Q3/rsLcBNdlQpuiNUGHUpzA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAyR59Pl4hLfYBOZuNjBeZC4h6NqO3sWf9C2F/owO43YAiBD+cpwTam9Fj9qXXQPyZx7KwTFWeUV6N4D/Db3EB6Nuw=="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anonymous","email":"jonathan@jclem.net"},"maintainers":[{"name":"anonymous","email":"jonathan@jclem.net"}],"directories":{}},"0.1.0":{"name":"path-proxy","version":"0.1.0","description":"A path proxy object constructor","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/jclem/path-proxy"},"keywords":["node","proxy"],"author":{"name":"Jonathan Clem"},"license":"MIT","bugs":{"url":"https://github.com/jclem/path-proxy/issues"},"dependencies":{"inflection":"~1.3.0"},"readme":"# path-proxy\n\nGiven an group of paths (say, from an API schema), you might need to create a\nset of proxy objects for interacting with those paths. This is the situation I\nfound myself in while working on the [Node client for the Heroku API][heroku_client].\n\nGiven a set of paths and a base constructor function, path-proxy will create a\nnetwork of logical proxy objects based on the paths and attach it to the\nconstructor's prototype.\n\n## Install\n\n```sh\nnpm install path-proxy --save\n```\n\n## Usage\n\n```javascript\nvar pathProxy = require('path-proxy');\n\nfunction ApiClient() {}\n\npathProxy.proxy(ApiClient, [\n  \"/foo\",\n  \"/foo/{id}/bar\"\n]);\n\nvar client = new ApiClient();\nclient.foo(\"qux\").bar();\n```\n\nThis may not appear all that useful—they're mostly just empty functions—until you\nstart mucking around with their prototypes:\n\n```javascript\nvar BarProxy = pathProxy.pathProxy(ApiClient, \"/foo/{id}/bar\");\nBarProxy.prototype.sayHello = function () {\n  console.log(\"hello\");\n};\n\nclient.foo(\"qux\").bar().sayHello(); // Logs \"hello\".\n```\n\nThey also have access to a few useful attributes:\n\n```javascript\nvar baz = client.foo(\"qux\").bar(\"baz\");\nbaz.params;       // [\"qux\", \"baz\"]\nbaz.pathSegments; // [\"foo\", \"qux\", \"bar\", \"baz\"]\nbaz.path;         // \"/foo/qux/bar/baz\"\n```\n\nAnd can access the instance of the base constructor they're based off of:\n\n```javascript\nApiClient.prototype.delete = function (path, callback) {\n  var message = this.name + \" deleted at \" + path;\n  callback(message);\n};\n\nvar client = new ApiClient();\nclient.name = \"Jonathan\";\n\nBarProxy.prototype.delete = function (callback) {\n  this.base.delete(this.path, callback);\n};\n\n// This:\nclient.foo(\"qux\").bar(\"baz\").delete(function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n\n// Is equivalent to this:\nclient.delete(\"/foo/qux/bar/baz\", function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n```\n\n## The End\n\nThat's all there is for now. This is might prove to be a useful tool for working\non documented API clients in the future. For now, don't rely on it. There are\nno tests, and it's more of a fun experiment at the moment\n\n[heroku_client]: https://github.com/heroku/node-heroku-client\n","readmeFilename":"README.md","_id":"path-proxy@0.1.0","dist":{"shasum":"2d2a1646865859128937e35bb4fcc704fc09d1cd","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/path-proxy/-/path-proxy-0.1.0.tgz","integrity":"sha512-vSEDL+m8+/zGDnXRmGEF9pKRPZjownH+4wGygy7cH6HRlNgrOQZHRG9f3+M1DF9SAXUdI+V+1mHVGl3RlEN3eg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrnM7er4ngtKbnX1E9/KQ+cW16dAPDkuYXp4dgGiEaHwIgRSwJB6lZSdP3trxcWJQW4rlBMq+v1MRj+ioyFl5dGJ4="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anonymous","email":"jonathan@jclem.net"},"maintainers":[{"name":"anonymous","email":"jonathan@jclem.net"}],"directories":{}},"0.1.1":{"name":"path-proxy","version":"0.1.1","description":"A path proxy object constructor","main":"index.js","scripts":{"test":"./node_modules/jasmine-node/bin/jasmine-node spec"},"repository":{"type":"git","url":"https://github.com/jclem/path-proxy"},"keywords":["node","proxy"],"author":{"name":"Jonathan Clem"},"license":"MIT","bugs":{"url":"https://github.com/jclem/path-proxy/issues"},"dependencies":{"inflection":"~1.3.0"},"devDependencies":{"jasmine-node":"~1.11.0"},"readme":"# path-proxy\n\nGiven an group of paths (say, from an API schema), you might need to create a\nset of proxy objects for interacting with those paths. This is the situation I\nfound myself in while working on the [Node client for the Heroku API][heroku_client].\n\nGiven a set of paths and a base constructor function, path-proxy will create a\nnetwork of logical proxy objects based on the paths and attach it to the\nconstructor's prototype.\n\n## Install\n\n```sh\nnpm install path-proxy --save\n```\n\n## Usage\n\n```javascript\nvar pathProxy = require('path-proxy');\n\nfunction ApiClient() {}\n\npathProxy.proxy(ApiClient, [\n  \"/foo\",\n  \"/foo/{id}/bar\"\n]);\n\nvar client = new ApiClient();\nclient.foo(\"qux\").bar();\n```\n\nThis may not appear all that useful—they're mostly just empty functions—until you\nstart mucking around with their prototypes:\n\n```javascript\nvar BarProxy = pathProxy.pathProxy(ApiClient, \"/foo/{id}/bar\");\nBarProxy.prototype.sayHello = function () {\n  console.log(\"hello\");\n};\n\nclient.foo(\"qux\").bar().sayHello(); // Logs \"hello\".\n```\n\nThey also have access to a few useful attributes:\n\n```javascript\nvar baz = client.foo(\"qux\").bar(\"baz\");\nbaz.params;       // [\"qux\", \"baz\"]\nbaz.pathSegments; // [\"foo\", \"qux\", \"bar\", \"baz\"]\nbaz.path;         // \"/foo/qux/bar/baz\"\n```\n\nAnd can access the instance of the base constructor they're based off of:\n\n```javascript\nApiClient.prototype.delete = function (path, callback) {\n  var message = this.name + \" deleted at \" + path;\n  callback(message);\n};\n\nvar client = new ApiClient();\nclient.name = \"Jonathan\";\n\nBarProxy.prototype.delete = function (callback) {\n  this.base.delete(this.path, callback);\n};\n\n// This:\nclient.foo(\"qux\").bar(\"baz\").delete(function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n\n// Is equivalent to this:\nclient.delete(\"/foo/qux/bar/baz\", function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n```\n\n## Tests\n\npath-proxy uses jasmine-node for tests. To run them:\n\n```sh\n$ npm install\n$ npm test\n```\n\n[heroku_client]: https://github.com/heroku/node-heroku-client\n","readmeFilename":"README.md","_id":"path-proxy@0.1.1","dist":{"shasum":"2651abb488cd2f127897b66e5aa75ebc69bf0d3d","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/path-proxy/-/path-proxy-0.1.1.tgz","integrity":"sha512-8Q2S1cEhbnLklbFIIf1MeOCGXTJBZddS9McHL5fEJQjyRyF53EPDP6lamF0n7RfUShTr/PbD8JBWtzYmSyw+Bw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCb3JirADM95QFYt8/lljIhKYgb7oZO4li+ivm8hl9PxgIhAL57S/dySihyc7O4zd0JBCFQjWG8HUbBeI41wFLZwQwm"}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anonymous","email":"jonathan@jclem.net"},"maintainers":[{"name":"anonymous","email":"jonathan@jclem.net"}],"directories":{}},"1.0.0":{"name":"path-proxy","version":"1.0.0","description":"A path proxy object constructor","main":"index.js","scripts":{"test":"./node_modules/jasmine-node/bin/jasmine-node spec"},"repository":{"type":"git","url":"https://github.com/jclem/path-proxy"},"keywords":["node","proxy"],"author":{"name":"Jonathan Clem"},"license":"MIT","bugs":{"url":"https://github.com/jclem/path-proxy/issues"},"dependencies":{"inflection":"~1.3.0"},"devDependencies":{"jasmine-node":"~1.11.0"},"readme":"# path-proxy\n\nGiven an group of paths (say, from an API schema), you might need to create a\nset of proxy objects for interacting with those paths. This is the situation I\nfound myself in while working on the [Node client for the Heroku API][heroku_client].\n\nGiven a set of paths and a base constructor function, path-proxy will create a\nnetwork of logical proxy objects based on the paths and attach it to the\nconstructor's prototype.\n\n## Install\n\n```sh\nnpm install path-proxy --save\n```\n\n## Usage\n\n```javascript\nvar pathProxy = require('path-proxy');\n\nfunction ApiClient() {}\n\npathProxy.proxy(ApiClient, [\n  \"/foo\",\n  \"/foo/{id}/bar\"\n]);\n\nvar client = new ApiClient();\nclient.foo(\"qux\").bar();\n```\n\nThis may not appear all that useful—they're mostly just empty functions—until you\nstart mucking around with their prototypes:\n\n```javascript\nvar BarProxy = pathProxy.pathProxy(ApiClient, \"/foo/{id}/bar\");\nBarProxy.prototype.sayHello = function () {\n  console.log(\"hello\");\n};\n\nclient.foo(\"qux\").bar().sayHello(); // Logs \"hello\".\n```\n\nThey also have access to a few useful attributes:\n\n```javascript\nvar baz = client.foo(\"qux\").bar(\"baz\");\nbaz.params;       // [\"qux\", \"baz\"]\nbaz.pathSegments; // [\"foo\", \"qux\", \"bar\", \"baz\"]\nbaz.path;         // \"/foo/qux/bar/baz\"\n```\n\nAnd can access the instance of the base constructor they're based off of:\n\n```javascript\nApiClient.prototype.delete = function (path, callback) {\n  var message = this.name + \" deleted at \" + path;\n  callback(message);\n};\n\nvar client = new ApiClient();\nclient.name = \"Jonathan\";\n\nBarProxy.prototype.delete = function (callback) {\n  this.base.delete(this.path, callback);\n};\n\n// This:\nclient.foo(\"qux\").bar(\"baz\").delete(function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n\n// Is equivalent to this:\nclient.delete(\"/foo/qux/bar/baz\", function (message) {\n  // message == \"Jonathan deleted at /foo/qux/bar/baz\"\n});\n```\n\n## Tests\n\npath-proxy uses jasmine-node for tests. To run them:\n\n```sh\n$ npm install\n$ npm test\n```\n\n[heroku_client]: https://github.com/heroku/node-heroku-client\n","readmeFilename":"README.md","homepage":"https://github.com/jclem/path-proxy","_id":"path-proxy@1.0.0","dist":{"shasum":"18e8a36859fc9d2f1a53b48dee138543c020de5e","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/path-proxy/-/path-proxy-1.0.0.tgz","integrity":"sha512-p9IuY9FRY1nU59RDW+tnLL6qMxmBnY03WGYxzy1FcqE5OMO5ggz7ahmOBH0JBS+9f95Yc7V5TZ+kHpTeFWaLQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEObCtWckyMvcgqzveSf9xjrYaSMfFi8kkdlRzcK8vLAIgRtauHA3/ngCytPgfJ4h8l2vHHszSBfvrvJseffLql6g="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"anonymous","email":"jonathan@jclem.net"},"maintainers":[{"name":"anonymous","email":"jonathan@jclem.net"}]}},"name":"path-proxy","time":{"modified":"2022-06-23T14:39:13.709Z","created":"2013-12-12T09:58:00.943Z","0.0.0":"2013-12-12T09:58:04.939Z","0.1.0":"2013-12-12T10:24:12.099Z","0.1.1":"2013-12-13T19:50:11.964Z","1.0.0":"2014-01-09T02:56:51.144Z"}}