{"id":18657812,"url":"https://github.com/lightsofapollo/middleware-object-hooks","last_synced_at":"2025-11-05T22:30:22.077Z","repository":{"id":13833356,"uuid":"16530177","full_name":"lightsofapollo/middleware-object-hooks","owner":"lightsofapollo","description":"(Promise based) Object middleware","archived":false,"fork":false,"pushed_at":"2015-05-06T05:03:25.000Z","size":432,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-27T18:52:13.816Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightsofapollo.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":"2014-02-05T00:07:48.000Z","updated_at":"2015-05-06T05:03:25.000Z","dependencies_parsed_at":"2022-09-13T17:41:49.179Z","dependency_job_id":null,"html_url":"https://github.com/lightsofapollo/middleware-object-hooks","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/lightsofapollo%2Fmiddleware-object-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmiddleware-object-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmiddleware-object-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmiddleware-object-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightsofapollo","download_url":"https://codeload.github.com/lightsofapollo/middleware-object-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239475960,"owners_count":19645041,"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-11-07T07:29:55.386Z","updated_at":"2025-11-05T22:30:22.026Z","avatar_url":"https://github.com/lightsofapollo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# middleware-object-hooks\n\n[![Build Status](https://travis-ci.org/lightsofapollo/middleware-object-hooks.png?branch=master)](https://travis-ci.org/lightsofapollo/middleware-object-hooks)\n\nMiddleware(ish) hooks based on \"methods\" in objects.\n\n\n## Usage\n\n(Also see [examples/](examples/))\n\n```js\nvar middleware = require('middleware-object-hooks');\n\nmiddlware.use({\n  start: function(value) {\n    value.calls = value.calls || 0;\n    return value;\n  }\n});\n\nmiddlware.use({\n  start: function(value) {\n    value.calls++;\n  }  \n});\n\nmiddlware.use({\n  start: function() {\n    return new Promise(function(accept, reject) {\n      // do some magic then accept / reject\n    });\n  }\n});\n\nmiddlware.run(\n  'start', // method in the middleware\n  {\n    // passed to the method in the middleware  \n  }\n).then(\n  function(value) {\n  },\n\n  function(err) {\n  }\n);\n```\n\n## Notes\n\n - Middleware methods are invoked within the context of their object\n\n - Multiple values may be passed to run (or none at all)\n\n - Each result is passed directly to the next middleware so its possible\n   to both mutate the value (if its an object) and entirely replace it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Fmiddleware-object-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightsofapollo%2Fmiddleware-object-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Fmiddleware-object-hooks/lists"}