{"_id":"independence","_rev":"40-2093aa3f3be02d2f3a38078564e5bab9","name":"independence","description":"Dependency injection helper","dist-tags":{"latest":"0.6.4"},"versions":{"0.0.1":{"name":"independence","version":"0.0.1","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s","coverage":"istanbul cover ./node_modules/.bin/_mocha -- -t 10s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0","istanbul":"~0.1.44"},"dependencies":{},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.0.1","dist":{"shasum":"b46327313d478698891417e35b9edb10d5b5ae95","tarball":"https://registry.npmjs.org/independence/-/independence-0.0.1.tgz","integrity":"sha512-Yjx7GH0n7O5HW4Ybj2756mrUzsGW/CekWi9SDCkGCtXgutbtkCbXb5iMMDaHhuXi/LzojSuA6LbyveSK3tKRLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZb1x3I3GvzyQfD0YMsKeNYwyzJ13aG+GXC+0RfWm0zAIgBhAlo/q655u7C9owp8WsPZMrYv9v40znwPbKjNau/8o="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.0.2":{"name":"independence","version":"0.0.2","description":"Dependency injection helper","main":"index.coffee","scripts":{"test":"mocha --compilers coffee:coffee-script/register -t 100s","coverage":"istanbul cover ./node_modules/.bin/_mocha -- -t 10s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0","istanbul":"~0.1.44","coffee-script":">=1.7.1"},"dependencies":{},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.0.2","dist":{"shasum":"c4c96cfcb5a73741f5ad6661b41a109713d080ca","tarball":"https://registry.npmjs.org/independence/-/independence-0.0.2.tgz","integrity":"sha512-Jv2iyumAAgpb1Sz82U7NCRrd90dSuoBsl0znCT2xrLfTe2x/inlGoq+suBBS5rF7CduNaywQorMsVIlblVPwGw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwZ51NuGTSNPDOfdaU9cnQCv0ycHc/izHneJqgLZ+usQIhAKbQygSxOZRiF2V9U/Z7tmQw1X3JJ7qFCa5TIgU4x+MD"}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.0.3":{"name":"independence","version":"0.0.3","description":"Dependency injection helper","main":"index.coffee","scripts":{"test":"mocha --compilers coffee:coffee-script/register -t 100s","coverage":"istanbul cover ./node_modules/.bin/_mocha -- -t 10s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0","istanbul":"~0.1.44","coffee-script":">=1.7.1"},"dependencies":{},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.0.3","dist":{"shasum":"b75d5e1457a697073bc30693e52a07c3a40c7631","tarball":"https://registry.npmjs.org/independence/-/independence-0.0.3.tgz","integrity":"sha512-5pU9Bv2pN+hf59RylBzdRQBf4qqbj/BwUFops3ZYUtFTChZMDh25moDYuDEoDSyDVpaJ/cCgekq1VZhObabg+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA20Zs+kO3pTAJaWUcxwqBryXhu/pRofh2Gwk5e/riAEAiEA6IhKnpmugkkx++FxIepNdeQbI8h47ndI4cK9JT9TzlY="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.1.0":{"name":"independence","version":"0.1.0","description":"Dependency injection helper","main":"index.coffee","scripts":{"test":"mocha --compilers coffee:coffee-script/register -t 100s","coverage":"istanbul cover ./node_modules/.bin/_mocha -- -t 10s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0","istanbul":"~0.1.44","coffee-script":">=1.7.1"},"dependencies":{},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.1.0","dist":{"shasum":"e556373481b611a0d6a30a139e66e0f96cc4c404","tarball":"https://registry.npmjs.org/independence/-/independence-0.1.0.tgz","integrity":"sha512-C1BYaXwEOeVwFJjUAPHpgwbsQSdMC/msSnKKcQXMX4U4g9GFcwqi30u9NSFzU0LanlfHizMXslNUv6c5UXc67A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGDw62xtjbfp0Us35Z+0CvDyNljfGte8D1bXNKLmsrECAiBaSFuFSMZmEWbsfhO8uiDBGavmd8brdLb9hR753atGVA=="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.2.0":{"name":"independence","version":"0.2.0","description":"Dependency injection helper","main":"index.coffee","scripts":{"test":"mocha --compilers coffee:coffee-script/register -t 100s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0","coffee-script":">=1.7.1"},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.2.0","dist":{"shasum":"611485ade418d0d0bdfd930ead9e47ce80aa3f83","tarball":"https://registry.npmjs.org/independence/-/independence-0.2.0.tgz","integrity":"sha512-4GvW4D9ICoC3lQ8XEoXBbw2oJrb+mLB6VpkVedH2ewjWf1mHA0pDwXziMfntFga4pGF3CZ7WOpi4H6Te62bsdA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF70v/B27wt9JTv1YvGnBsHNpfsEwSNZLwev9MeyiwX4AiBgRZoOnk+t5iZG09JkvZq0EpRDRFikYstA3AahC0tpaQ=="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.2.1":{"name":"independence","version":"0.2.1","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0"},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.2.1","dist":{"shasum":"44fee6980d5a7e830f02a4dcee77a31666320781","tarball":"https://registry.npmjs.org/independence/-/independence-0.2.1.tgz","integrity":"sha512-1GsqUM4he1pSoqwr1db4M61jBBUOYhJ1FV8eDR8jta6k8mHi79B6hvTLLHoWZpEs5L/0VSsqRGRLT+YOwLWbjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIANjBMlHvsgTD9B25Xc8/slor1uZhSmwZdBKrw7iCA0VAiArIG1uYR27TOX4AXYaiywb5Y5F9FItSmdWvPDyNCGmdw=="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.5.0":{"name":"independence","version":"0.5.0","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0"},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","_id":"independence@0.5.0","dist":{"shasum":"d685a5b0d7f2bf8eccd0f398ba89621f0c4509ae","tarball":"https://registry.npmjs.org/independence/-/independence-0.5.0.tgz","integrity":"sha512-llVbgIwURUWcHVYF2ekQS3QhbV58ace0dzo97Qa0U/Nh3ci+1XMRBdQOv1gzbdtcZ/8io9+a135Kb8hYaioRLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5DScffhuvVV9EeslUWdx26V7sXvTYVIWP2UsGKez46wIgNEl/LbJRSxwhTz5j8lgmVBIH4XXol4aI6yC4rCAZBGM="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}]},"0.5.1":{"name":"independence","version":"0.5.1","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s"},"bin":{"independence-wrapper":"./bin/wrapper"},"repository":{"type":"git","url":"https://github.com/xarvh/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"contributors":[{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com"}],"license":"MIT","devDependencies":{"should":"~2.0.2","mocha":"~1.13.0"},"bugs":{"url":"https://github.com/xarvh/independence/issues"},"homepage":"https://github.com/xarvh/independence","gitHead":"f22ba26837dcf50d09a37e33c295028bfd608193","_id":"independence@0.5.1","_shasum":"3e84e3f55701749634a101cfe2d27cffdbaee314","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}],"dist":{"shasum":"3e84e3f55701749634a101cfe2d27cffdbaee314","tarball":"https://registry.npmjs.org/independence/-/independence-0.5.1.tgz","integrity":"sha512-KKWJZ6VbKXIsKslgSyoM0rVpJxp7W/03hs2KG3cOX5xNabx9W3qnvXeszE3p9YcCV3jelJBoWQaz+fqvRzEmkg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCW7zO7X1Zxb+owOkhIGxG2JZtdCEPs25WVfwsb77g7gwIgPhwSH5Wkb1IeGcJjOxUVzRezqp+yb4cdSWEvPUadMVk="}]}},"0.6.1":{"name":"independence","version":"0.6.1","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s"},"bin":{"independence-wrapper":"./bin/wrapper"},"repository":{"type":"git","url":"https://github.com/Adslot/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"contributors":[{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com"}],"license":"MIT","devDependencies":{"coffee-script":"1.8.x","should":"2.0.x","mocha":"1.13.x"},"bugs":{"url":"https://github.com/Adslot/independence/issues"},"homepage":"https://github.com/Adslot/independence","gitHead":"76051574fc6ffa0d80fe069d04b6e59e37d46497","_id":"independence@0.6.1","_shasum":"9a2b9caadd8f0a401abb0acedb12db29cc45f2b1","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}],"dist":{"shasum":"9a2b9caadd8f0a401abb0acedb12db29cc45f2b1","tarball":"https://registry.npmjs.org/independence/-/independence-0.6.1.tgz","integrity":"sha512-1GKmfh1QEACa5kb6ojeuXOPC6zMZtNwqfJRjopkoGPUeH8nKtqi5KCt5HnX9RljPzbRVfb6iMSOH0jUIMxPH8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChYGEvzOH7OXB5IMvn0BfLug+5oY3jf+PdpPR7He7NUQIhANEVcLrBVAsXycT3G+emF1wrVNb5jSVAWA9d8NPGH4uz"}]}},"0.6.2":{"name":"independence","version":"0.6.2","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s"},"bin":{"independence-coffee-wrap":"./bin/coffee-wrap"},"repository":{"type":"git","url":"https://github.com/Adslot/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"contributors":[{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com"}],"license":"MIT","devDependencies":{"coffee-script":"1.8.x","should":"2.0.x","mocha":"1.13.x"},"bugs":{"url":"https://github.com/Adslot/independence/issues"},"homepage":"https://github.com/Adslot/independence","gitHead":"07c88ae2e59772f9714c2158e5ef8278738978e0","_id":"independence@0.6.2","_shasum":"67d7f5127c669b1e513ba1872ef9911f0cc8a6a6","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}],"dist":{"shasum":"67d7f5127c669b1e513ba1872ef9911f0cc8a6a6","tarball":"https://registry.npmjs.org/independence/-/independence-0.6.2.tgz","integrity":"sha512-2H/rkMCwiR8bbvwonSo/RAl7W8a6wpO/sAzZKb8yNvKTVBTvdQVpX1yKhGCADBvvUjaFH2+KuemV29j19VIxew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDlWiNFFWljelzruF5V1wAz4Jp1rWcqgi8ey4sLyOz4bgIhAIt3wWtLX8GI06/1j4i7YDjKzp3/9vo0yQ1u7+5qK/1J"}]}},"0.6.3":{"name":"independence","version":"0.6.3","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s && jshint index.js"},"bin":{"independence-coffee-wrap":"./bin/coffee-wrap"},"repository":{"type":"git","url":"https://github.com/Adslot/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"contributors":[{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com"}],"license":"MIT","devDependencies":{"coffee-script":"1.8.x","jshint":"2.5.10","should":"2.0.x","mocha":"1.13.x","knox":"https://github.com/LearnBoost/knox/archive/4ff7116259f69196affb154a2f7bb26a188ebd31.tar.gz","bcrypt":"https://github.com/ncb000gt/node.bcrypt.js/archive/360b1663eab81920b116c6a8ad128533b3bc642c.tar.gz"},"bugs":{"url":"https://github.com/Adslot/independence/issues"},"homepage":"https://github.com/Adslot/independence","gitHead":"1047dc6afe92a4078b4fb1d8a3f51a8e103d8fca","_id":"independence@0.6.3","_shasum":"3dba2328d5148a9ee5fd93cd0c2756ca9c254446","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}],"dist":{"shasum":"3dba2328d5148a9ee5fd93cd0c2756ca9c254446","tarball":"https://registry.npmjs.org/independence/-/independence-0.6.3.tgz","integrity":"sha512-ikCjtmi9U1a8MLRb3dmBftyKRoG8i8Ae7FegoMXdBczWkMmo7t3LyIb01mgfFv0R38SoD2DpmUn7qaKsjIFeRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQyXZcUC6juDdD4bymZcI9qqxC+AskFT06PxfGAjSHNQIgfZLopThMMP7x1H/JQses6v7J9wIECsBsQ5EYNX3hCgo="}]}},"0.6.4":{"name":"independence","version":"0.6.4","description":"Dependency injection helper","main":"index.js","scripts":{"test":"mocha -t 100s && jshint index.js"},"bin":{"independence-coffee-wrap":"./bin/coffee-wrap"},"repository":{"type":"git","url":"https://github.com/Adslot/independence.git"},"keywords":["require","dependency injection","test"],"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"contributors":[{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com"}],"license":"MIT","devDependencies":{"coffee-script":"1.8.x","jshint":"2.5.10","should":"2.0.x","mocha":"1.13.x","knox":"https://github.com/LearnBoost/knox/archive/4ff7116259f69196affb154a2f7bb26a188ebd31.tar.gz","bcrypt":"https://github.com/ncb000gt/node.bcrypt.js/archive/360b1663eab81920b116c6a8ad128533b3bc642c.tar.gz"},"bugs":{"url":"https://github.com/Adslot/independence/issues"},"homepage":"https://github.com/Adslot/independence","gitHead":"4a2ab12dba175fae6a949c241aa7cf95bfaa5049","_id":"independence@0.6.4","_shasum":"25f49b417741800b4664e6dfd266e2e3aefe0b91","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"xarvh","email":"francesco.orsenigo@adslot.com"},"maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}],"dist":{"shasum":"25f49b417741800b4664e6dfd266e2e3aefe0b91","tarball":"https://registry.npmjs.org/independence/-/independence-0.6.4.tgz","integrity":"sha512-VwKWXhHiYVvhSw3ijycJgnUP12qMAwGLkNedeVMAxkROORpcSiT75yqddhAm1NCMRC1mr1gKDkh4mRuTaqWQgQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIZe8w+AmoqFzfEATN2tgF0t8CnG1jgeVHQQXiNINoawIgLEdp6fsgh9Xn49xVMRxombaava3UjfUiQ9iJW0aJd7Q="}]}}},"readme":"Independence\n============\n[![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-url]][daviddm-image]\n[![Build Status](https://secure.travis-ci.org/Adslot/independence.png?branch=master)](http://travis-ci.org/Adslot/independence)\n\nModule dependency injection for easy and fast mocking.\n\nEnables a module to quickly create clones of itself that have their dependencies mocked.\n\n\nWhen writing the module\n-----------------------\nWrap your module in\n`\"require('independence')(require, module, (function(require, module, exports) {\" + yourCode + \"}))\"`.\n\n```javascript\n// monkey.js\n\nrequire('independence')(require, module, function(require, module, exports){\n\n  var moment = require('moment');\n  var _ = require('lodash');\n  var myService = require('../common/lib/services/myService');\n  var myDatabase = require('../common/lib/myDatabase');\n\n  exports.fling = function() {\n    console.log('fling', moment().format 'YYYY-MM-DD');\n  };\n\n  exports.swing = function() {\n    console.log('swing', _.find([1, 2, 3, 5, 7], (n) -> n % 2 is 0));\n  };\n});\n```\n\nWith [CoffeeScript](http://coffeescript.org/), you can `require()` the provided\n[coffee-wrap](bin/coffee-wrap) to automatically wrap all your `.coffee` modules\nwhen transpiling them to JavaScript.\n\n\nWhen using the module\n---------------------\nThis works as normal:\n```javascript\n// someModule.js\n\nvar monkey = require('./monkey');\n\nmonkey.fling(); // Will output `fling 2014-05-23`\nmonkey.swing(); // Will output `swing 2`\n```\n\n\nWhen testing the module\n-----------------------\n```javascript\n// tests/monkey.js\n\nvar monkey = require('./monkey');\n\nfunction momentMock() {\n  return {\n    format: function() {\n      return \"Yaaap!\";\n    }\n  };\n}\n\n\n// Provide only moment and leave all other dependencies undefined:\nvar pureMonkey = monkey.independence('isolate', {moment: momentMock});\n\npureMonkey.fling() // Outputs `fling Yaaap!`\npureMonkey.swing() // Fails because `_` is an empty Object\n\n\n// Override moment, but leave all other dependencies nominal:\nvar testMonkey = monkey.independence('override', {moment: momentMock});\n\ntestMonkey.fling() // Outputs `fling Yaaap!`\ntestMonkey.swing() // Works as normal\n\n\n// Override moment in the monkey module and in ALL its wrapped dependencies\n// recursively (in this case, myService and myDatabase):\nvar testMonkey = monkey.independence('rebuild', {moment: momentMock});\n```\n\n\nBut what if two modules have the same name?\n---------------------------------------\n```javascript\n// controller.js\nvar userModel = require('../lib/models/user');\nvar userController = require('./user');\n\n...\n```\n\n```javascript\n// tests/controller.js\nvar controller = require('../controllers/controller');\n\nvar testController = controller.independence('isolate', {\n    'models/user': userModelMock,\n    'controllers/user': userControllerMock\n  });\n\n...\n```\n\n\nOther stuff you can do\n----------------------\n\nChain dependency objects:\n```javascript\nvar commonDependencies = {\n  lodash: require('lodash'),\n  myDatabase: {log: function(){}},\n  myService: function(){ return 'serviced';}\n};\n\nvar testMonkey = monkey.independence('isolate', commonDependencies, {\n  moment: function(){ return {format: function(){ return 'Yip!';}};}\n};\n```\n\n\nClone & monkey-patch:\n```javascript\nvar database = require('database');\n\nvar databaseTest = database.independence('override');\ndatabaseTest.getBananas = function(callback) {\n  callback(null, ['banana1', 'banana2']);\n};\n```\n\n\nCoffee & Mocha\n--------------\n\nIf you're using [CoffeeScript](http://coffeescript.org/) and\n[Mocha](http://mochajs.org/) you can use [bin/coffee-wrap](bin/coffee-wrap) to\ncompiles and wraps `.coffee` modules with the Independence header:\n\n`mocha --compilers coffee:independence/bin/coffee-wrap`\n\n[npm-url]: https://npmjs.org/package/independence\n[npm-image]: https://badge.fury.io/js/independence.svg\n[daviddm-url]: https://david-dm.org/adslot/independence.svg?theme=shields.io\n[daviddm-image]: https://david-dm.org/adslot/independence\n","maintainers":[{"name":"xarvh","email":"francesco.orsenigo@adslot.com"}],"time":{"modified":"2022-06-19T01:03:38.993Z","created":"2014-05-22T01:16:17.421Z","0.0.1":"2014-05-22T01:16:19.638Z","0.0.2":"2014-05-22T23:20:54.541Z","0.0.3":"2014-06-04T03:53:49.253Z","0.1.0":"2014-06-04T04:58:41.295Z","0.2.0":"2014-06-06T03:37:24.854Z","0.2.1":"2014-06-10T06:55:38.957Z","0.5.0":"2014-06-17T05:08:32.150Z","0.5.1":"2014-08-15T06:22:41.238Z","0.6.1":"2014-11-03T04:49:22.668Z","0.6.2":"2014-11-03T05:16:13.664Z","0.6.3":"2014-12-17T05:07:23.298Z","0.6.4":"2014-12-17T05:33:02.978Z"},"readmeFilename":"README.md","homepage":"https://github.com/Adslot/independence","keywords":["require","dependency injection","test"],"repository":{"type":"git","url":"https://github.com/Adslot/independence.git"},"author":{"name":"Francesco Orsenigo","email":"francesco.orsenigo@gmail.com","url":"http://github.com/xarvh"},"bugs":{"url":"https://github.com/Adslot/independence/issues"},"license":"MIT","contributors":[{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com"}]}