{"id":21894770,"url":"https://github.com/zumba/middleman.js","last_synced_at":"2025-06-13T19:37:00.461Z","repository":{"id":6857383,"uuid":"8106200","full_name":"zumba/middleman.js","owner":"zumba","description":"A small library that lets you inject some code between a third party library and the execution context.","archived":false,"fork":false,"pushed_at":"2013-02-17T17:15:32.000Z","size":263,"stargazers_count":26,"open_issues_count":1,"forks_count":0,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-17T11:37:38.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://engineering.zumba.com/middleman.js/","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/zumba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-09T04:44:17.000Z","updated_at":"2025-01-02T01:13:42.000Z","dependencies_parsed_at":"2022-09-18T10:50:56.169Z","dependency_job_id":null,"html_url":"https://github.com/zumba/middleman.js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zumba/middleman.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumba%2Fmiddleman.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumba%2Fmiddleman.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumba%2Fmiddleman.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumba%2Fmiddleman.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zumba","download_url":"https://codeload.github.com/zumba/middleman.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumba%2Fmiddleman.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259708112,"owners_count":22899543,"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-28T13:28:04.510Z","updated_at":"2025-06-13T19:37:00.438Z","avatar_url":"https://github.com/zumba.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Middleman.js\nA small library that lets you inject some code between a third party library and the execution\ncontext.  With **Middleman.js** you can easily:\n\n* filter arguments passed to an original method,\n* pass one function's arguments to another function, or\n* overload a third party method to change how it works\n\n[![Build Status](https://secure.travis-ci.org/zumba/middleman.js.png)](http://travis-ci.org/zumba/middleman.js)\n\n## Links\n* [Development version 0.1.0](https://github.com/zumba/middleman.js/blob/master/dist/middleman-0.1.0.js) **2.27kb** Uncompressed\n* [Production version 0.1.0](https://github.com/zumba/middleman.js/blob/master/dist/middleman-0.1.0.min.js) **0.6kb** Minified\n* [Unit tests](https://github.com/zumba/middleman.js/blob/master/test/spec/middleman.spec.js)\n\n## Example\nLet's say you add a third party library to your application that has a method called `doSomethingCool`.\n```javascript\n    var ThirdPartyLibrary = {\n        doSomethingCool : function(firstParam, isAwesome) {\n            // do something cool with firstParam, then:\n            if (isAwesome){\n                console.log('All up in your app, doing awesome things.');\n            }\n        };\n    };\n```\n\nYou decide that you want to force the second parameter `isAwesome` to be `true` every time\n`doSomethingCool` is called because your application is totally awesome.  You *could* just write a\nwrapper method like this:\n```javascript\n    var AwesomeApplication = {\n        doSomethingCool : function(firstParam) {\n            return ThirdPartyLibrary.doSomethingCool(firstParam, true);\n        }\n    };\n\n    AwesomeApplication.doSomethingCool('blah blah blah');\n    /**\n     * console: All up in your app, doing awesome things.\n     */\n```\n\nHowever, now you have to remember to call your method instead of the original method.\nWhat if `ThirdPartyLibrary` is very popular (e.g. jQuery)?  Your colleague Tony has been using\n`ThirdPartyLibrary` for years.  He doesn't remember to use your wrapper function when writing new\ncode for your application.\n\n**Middlman.js** gets between Tony and `ThirdPartyLibrary`, so your application stays awesome. :expressionless:\n```javascript\n    var MM = new Middleman();\n\n    MM.map({\n        lib : ThirdPartyLibrary,\n        method : 'doSomethingCool',\n        filter : function(args) {\n            // make the second parameter true\n            args[1] = true;\n            return args;\n        }\n    });\n\n    ThirdPartyLibrary.doSomethingCool(\"I'm Tony, and the second param is undefined.\");\n    /**\n     * console: All up in your app, doing awesome things.\n     */\n```\n\nPiece of cake.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumba%2Fmiddleman.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzumba%2Fmiddleman.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumba%2Fmiddleman.js/lists"}