{"_id":"inject-js","_rev":"28-f96fc034243dc4815d0f057014978eaa","name":"inject-js","description":"lightweight, small, high level dependency injector with object lifetime management","dist-tags":{"latest":"0.5.7","beta":"0.5.4"},"versions":{"0.3.0":{"name":"inject-js","version":"0.3.0","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.2.1","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"^3.5.0"},"gitHead":"3bb0c243804e7a0a5bfb774001e70781b784c524","_id":"inject-js@0.3.0","scripts":{},"_shasum":"910405e1999e7f36c7bed79f6356f9403d6d9789","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"910405e1999e7f36c7bed79f6356f9403d6d9789","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.3.0.tgz","integrity":"sha512-5SqyCaCjSS8YAYLPKfKmUrCZh4o1h/kBK94ym9Myp/TWWqdGGj6yS6A0P+X96/G5YSYXIUnyHEnvktlmOfb4fA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHGXmtoT9JQmrYkvQPLXhYnxMvGLj6GxCjh9698eqB2TAiEAnbyJUCH5j0katA9Vk8Cn/x7d17CRJZi/b/nHkzPDeYA="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/inject-js-0.3.0.tgz_1458169451134_0.5254780624527484"},"directories":{}},"0.3.1":{"name":"inject-js","version":"0.3.1","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.2.1","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"^3.5.0"},"gitHead":"2c73c501ce581742484d86b13033ea1b03f52395","_id":"inject-js@0.3.1","scripts":{},"_shasum":"1995d93ca2c28deaad7796d812c2363f71d75ad2","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"1995d93ca2c28deaad7796d812c2363f71d75ad2","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.3.1.tgz","integrity":"sha512-MQkZfvsTuliQqniC3cZCxTs4u2/QBR4a2AypLlsyOCqQ2C7iTNj/F4g74uMKNm/VAiqvp3Oxw94SACJ46Qjmug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6pTJXJBzanDxqY9FP5P8I6HldA98UP5f84sCqmz69lAIhAOeKdBnivIAaE6Cfjp0g76vzCIvJP9JUs/70XG7/QnRF"}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.3.1.tgz_1458175691628_0.11633463483303785"},"directories":{}},"0.3.2":{"name":"inject-js","version":"0.3.2","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.2.1","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"2b39ae9e020343f118ee1144d39993ea0d4bad92","_id":"inject-js@0.3.2","scripts":{},"_shasum":"1e183710e41f419061555fa6cc64cc59c6efb185","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"1e183710e41f419061555fa6cc64cc59c6efb185","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.3.2.tgz","integrity":"sha512-AzNOolLlb+u/Mx9alye8D0ffvkn7R/06LxzlmGobB25WyQQU1wNQq5jGsYiYpQ4sYdOvFtNeQRg4Ip3vt3NuKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcDkbmVVCff7CgBLXXUeg9QTGTLXFRbb/PwErxA2GwfQIhAIzEH4/YiJ1aaXuYRJ7uDR7IlOwQMZZXpV7EwQw6hvf5"}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/inject-js-0.3.2.tgz_1458178046979_0.49272015620954335"},"directories":{}},"0.3.3":{"name":"inject-js","version":"0.3.3","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.2.1","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"1b20ec8196f5f8972df1254bda0bea324896ccda","_id":"inject-js@0.3.3","scripts":{},"_shasum":"191e0c33430e9ceae21347911b302e2bcebf8996","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"191e0c33430e9ceae21347911b302e2bcebf8996","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.3.3.tgz","integrity":"sha512-x87f0sNDfeDo4+CeAfWMvM8fsKkAE+ZJHclBss5JlEET+/G/TNKzwXrbl/gkrrNe6gpM9uTuz40mfs7bYpqXTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/LJf0QuY27+yiEEf16FU+JYb5IUJJnB5xUkvUkVTzTAIhAIv5S1yZLeD5XwhsNlSFzBOmKoeoqSbg21uoriro7Enx"}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.3.3.tgz_1458697692885_0.9763317690230906"},"directories":{}},"0.3.4":{"name":"inject-js","version":"0.3.4","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.2.1","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"a0f086315364e9deceb387c32f3d282aca696da5","_id":"inject-js@0.3.4","scripts":{},"_shasum":"0a8ba41ec6a9210df193ddf0e2023e9106b7078f","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"0a8ba41ec6a9210df193ddf0e2023e9106b7078f","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.3.4.tgz","integrity":"sha512-/yxKXnFA/+51MEU2am/JN93K7hBhHieU7tmm7Fu/S7IJCAiNr6ME9fqOxBb0CeNuOuYPdAzhh9PVF5qwsIRlBA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFALo0erJTVxvR55gdE1Bo/T7akqUg2fLcmSQeO0HWv5AiEArekTXw2iANC+DVOIax0OT/ZwQ92wYETX1JvzMnKiJ6M="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.3.4.tgz_1458783054626_0.5579797660466284"},"directories":{}},"0.4.0":{"name":"inject-js","version":"0.4.0","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"2a5aeb65a18497868531950613fcc76f7d2596ec","_id":"inject-js@0.4.0","scripts":{},"_shasum":"4706b025288c667361abb08e789192439ed98fa2","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"4706b025288c667361abb08e789192439ed98fa2","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.0.tgz","integrity":"sha512-iFF2xAGV/3pL5dJv54ZD1ulKvSKr6aTF3QpSqpxrBTBQ96RsvCoBnQVeBmS/LS9f4Wugn/RfigYW0yJVBY2cGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/8TMgZj51k72YgMJZAdoUhrH/OG/m+AxcphJK0crPIwIgBsGmWZ6AocRq+VmHrQbmx0fvTZaWSYG8TNmu22tbn6M="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.0.tgz_1459327081683_0.9929722214583308"},"directories":{}},"0.4.1":{"name":"inject-js","version":"0.4.1","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"d1a110ec912a4ed30366bc6154aa6939c834db82","_id":"inject-js@0.4.1","scripts":{},"_shasum":"4ece527b25bf30ae48a715f2c549712104f231de","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"4ece527b25bf30ae48a715f2c549712104f231de","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.1.tgz","integrity":"sha512-O+0SRGWl74/lAt4YDPb02Z/P3K34R69mT0yHRL+8FNvw6tEpVwP73cRmI1NYAehdkFYuOoZ3Pc3+AaawmduZrQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCUnoXMt0inb6XgBE62od8BBWo0I2flQaDfnZl2tD+egwIgc1fSzF0ToKro506NrN1akFTzy7ClZzO61RtvBU8aQno="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.1.tgz_1459990358754_0.8950002687051892"},"directories":{}},"0.4.3":{"name":"inject-js","version":"0.4.3","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"6755c7258b00ddcfa77fe90b6712459df32e17ff","_id":"inject-js@0.4.3","scripts":{},"_shasum":"6e03cd7403e5298803ff7f849ecbac8e8bc5b544","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"6e03cd7403e5298803ff7f849ecbac8e8bc5b544","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.3.tgz","integrity":"sha512-yW784eJ42UFWCrvg62DEbIasIYxQndAp88x7KOjY+9dsR4rSK70zsL2rWAlC7VSdt20Pn+T/DawVKb3ed9/klA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRD0OVJBJ3mvalEIDn5mc3o9obJxnFl1vbBDTE3B448AIgBWTotqhPswbmtuA56JREHIYJkuAJhtTGryPS0EU3zwE="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.3.tgz_1459996189533_0.773340652231127"},"directories":{}},"0.4.4":{"name":"inject-js","version":"0.4.4","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"56bd111d40f0e0f1a3975d61d20327e0cb6cc50e","_id":"inject-js@0.4.4","scripts":{},"_shasum":"34c6223b2b3126f542e560ef94ccf970c0b65eec","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"34c6223b2b3126f542e560ef94ccf970c0b65eec","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.4.tgz","integrity":"sha512-e1CPfZAN4HiWOhVe2k1fEsBIvDrjtMV0j1UBuDH7gjVpqA/qqVi9wEFXc2J0zsvPQ9jh0udtb1Cg59yzfYbDhw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDm4LvoLQlwudlKCZubl1MbXVJQgb17/LrwaW+TIRrsUQIgCfCxokqbfu5I5Bk0/u64cQOvZjX0QL7sx+rhVoHykm0="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.4.tgz_1460005925914_0.1715927633922547"},"directories":{}},"0.4.5":{"name":"inject-js","version":"0.4.5","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"56bd111d40f0e0f1a3975d61d20327e0cb6cc50e","_id":"inject-js@0.4.5","scripts":{},"_shasum":"05a143c381446ffa91ec3bb9965f0138c23b8f3f","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"05a143c381446ffa91ec3bb9965f0138c23b8f3f","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.5.tgz","integrity":"sha512-bISqIBNt2mICgExinjuCFqyuf2JbZgz4H9GE1Fgk3YgS0q2KlOfOTZ7DcIbw9Z5JwjPKFH4i++o9arH0Rgy/5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFKUtpsiJPvHD8VhrpWSQn+xrOnqaFQ7iZuNhd6g8z63AiEAu14HkfSOdlTLhKTSaIXqv1eb8O13U8TehjYZzz6l/+U="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.5.tgz_1460010670263_0.769566748989746"},"directories":{}},"0.4.6":{"name":"inject-js","version":"0.4.6","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"cbf429ba3ad6e9d6aecc079ac4ba07799d8bf335","_id":"inject-js@0.4.6","scripts":{},"_shasum":"4064370e805d07a8c0d37fe98ac5e1ee6fe9bd78","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"4064370e805d07a8c0d37fe98ac5e1ee6fe9bd78","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.6.tgz","integrity":"sha512-ZI//4DjeM9YOmr1jU9h9YG7IcUT+/Hmq81i3YL2BOmh+P77xmO5SXHODoCxajHrQ6FcY4mnEHW0Au/kl7aGo0A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTPKve4XPS1lxjz0qpf9rGuKfhlQMZUbvhXzun0wW7swIhANNBbuf/zjM7VeEWcgip0S6P+xaa2i3rv2ovOzPWlf4V"}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.6.tgz_1460014958646_0.15905832941643894"},"directories":{}},"0.4.7":{"name":"inject-js","version":"0.4.7","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"b36138bd7fd700b002b8410302ddda477ebbd580","_id":"inject-js@0.4.7","scripts":{},"_shasum":"a9722afe1c42b78ff7060b5924d3583eef15db5a","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"a9722afe1c42b78ff7060b5924d3583eef15db5a","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.7.tgz","integrity":"sha512-EMcfCmOjgBaqztaA38m3qCQ2sfj0pfI9R5RNHYTWa3y+yjiWYuhwM/FKQqh3INcmLp6niJX6i31THZRWBSYTyA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCuE7KMHhGH99tGTJ8fuXVifTJD2psR+uRFNpNL6N83DQIgN5aoF/x9zZZHTv4Nm+oN1pw/qUFpxZ/LBxBwmN6DOw4="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.7.tgz_1460021206296_0.8516544555313885"},"directories":{}},"0.4.8":{"name":"inject-js","version":"0.4.8","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"ffcac37b018df0f960f75f2038437359eb796141","_id":"inject-js@0.4.8","scripts":{},"_shasum":"a5ece81163fe150997ee9a340918c957b6c11290","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"a5ece81163fe150997ee9a340918c957b6c11290","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.8.tgz","integrity":"sha512-9EqgQGNfu73w4Ff6Pr5l8vTnE8vscuf4TA/EuALPxXxcRHMBpAQLtNizqxJazZAD69CiusZJukfK/UflRWfuFg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfpS7ai03AFcelCUV5AlXMoxsd6ViXdqQppY8ch8aj7gIgMJk0Jq8l/aoFzOli2xXvxZN1XdyNwDZ6jQ9VYPK+kt0="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.8.tgz_1460021944598_0.4028761009685695"},"directories":{}},"0.4.9":{"name":"inject-js","version":"0.4.9","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"a846dc7e4458295d5cff2382e56b21cd387f5f33","_id":"inject-js@0.4.9","scripts":{},"_shasum":"2d6163a0e232ee16be4816447245bbee2400a16b","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"2d6163a0e232ee16be4816447245bbee2400a16b","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.9.tgz","integrity":"sha512-ih3U1ymJwCRGB3nSKQi+hE48obZW3MJxWzFN2p19lUX5qD/iwc54ZzU7qp17p2zbV/7ale+jr5H4umD4upL2Kg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpZ1AbUtB/nTCx6TuDUsaVTjiXH+F6NNdnCxcqgAodcwIgcHYDlYNvZGT7i/AguSJT2wfiqn8RMtLxVameOkV95Ko="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.9.tgz_1460037445897_0.7640556625556201"},"directories":{}},"0.4.10":{"name":"inject-js","version":"0.4.10","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"2fa5ed53c4291c0d44ed859c5e84c7172f4b175f","_id":"inject-js@0.4.10","scripts":{},"_shasum":"63bdfd92cd0caf9359144851a18dda82a3997074","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"63bdfd92cd0caf9359144851a18dda82a3997074","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.10.tgz","integrity":"sha512-CjvsuUPik1iOBIq0iUqKdmM7vgCeDqO6U+6gfbLtFfnsFizpxu8zCtb6FeUpWcDXIBV+fRGsFi65rWLCY4hAdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA/73o8evtbfxI0E2Jx6z6o81MmKbDCHqRGnt8wvxi99AiBASUEke67xX6YhT7qwOGaOLGUMDdaAdzBi6kZF3Zks0Q=="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.10.tgz_1460077626182_0.9589720754884183"},"directories":{}},"0.4.11":{"name":"inject-js","version":"0.4.11","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"431c6af704d9183616ba1f1b6e67ac64e4e3a4ed","_id":"inject-js@0.4.11","scripts":{},"_shasum":"4eb8c574609e2f271177e1b627938c312551a01e","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"4eb8c574609e2f271177e1b627938c312551a01e","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.11.tgz","integrity":"sha512-KfZHPBXKZghZdM8CP0ps17v3ONNrHS6jeXpN740yOYgvj2FdHGQr93aC7Y6u4x+Swpc32eq50jWm+XlVK0uYOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEsMAe/mgQzWZZRrd2qNGLPf2gN6/XvM2Vkdf3mDasgJAiA/pZUIHjy2arwafkeRmH0y79NEGZafUjUeUajwQNnvww=="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.11.tgz_1460078196261_0.28893241006881"},"directories":{}},"0.4.12":{"name":"inject-js","version":"0.4.12","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"686858bd2bd03fecf94fdc00fd0ceaa53c9bf18e","_id":"inject-js@0.4.12","scripts":{},"_shasum":"777a46a5afd858362cc7a5e530fd39a9c7fb59a7","_from":".","_npmVersion":"3.8.6","_nodeVersion":"0.10.44","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"777a46a5afd858362cc7a5e530fd39a9c7fb59a7","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.12.tgz","integrity":"sha512-0XjmwyM86TmNilbiNEcGndesVGIUjhUnybtkqAin071lUrlqbvCDGWa1mNU03VnKKZZrjjA5na5EIK1Sje+rhg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCf1tNCQuZ5aYxMSD+F5ZHGMoTC91873l/CBbb5CFU6EgIhAM+iRl6MTkILNj5HozYLUOvl3z75iY59oKt8V3MT9LPr"}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.12.tgz_1460110152562_0.14978652354329824"},"directories":{}},"0.4.13":{"name":"inject-js","version":"0.4.13","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"7149388b11f0d9c49f3a50457ad81af6a342d56a","_id":"inject-js@0.4.13","scripts":{},"_shasum":"e78b9148e9e2f462f7afac99ec15461193a860fb","_from":".","_npmVersion":"2.15.0","_nodeVersion":"4.4.2","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"e78b9148e9e2f462f7afac99ec15461193a860fb","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.13.tgz","integrity":"sha512-/it7tcijXwBVoubfIP1gwKaRxBZUEtdd5E06+RFq4AQ3X4xNiTUxRBOOHC+SK3zh4qiOw3MMa2DsY5fui6kKXg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE5sKL/Qzit7UtH1ZhoGkZ2wtNbvpI9ht0Re2GyJABAYAiEArwa5AasPvkuusdNk/o60Y6x20/H3WfRV4LpQWJjGm8E="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.13.tgz_1461140840566_0.4375311436597258"},"directories":{}},"0.4.14":{"name":"inject-js","version":"0.4.14","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"fe53ceaaadf0a0008168c836201d2b102fc9d039","_id":"inject-js@0.4.14","scripts":{},"_shasum":"1e708384257b24bd768cddb85b4f1aa47e60e3b9","_from":".","_npmVersion":"2.15.0","_nodeVersion":"4.4.2","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"1e708384257b24bd768cddb85b4f1aa47e60e3b9","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.14.tgz","integrity":"sha512-lWfbC45bAbCfmravTHf5K1g9m+ezqrCBRiv36WmJw1QOgh5+WpRQKAeefUfFdIQeGaJ0EUIz/mqvDVeO7silHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHCdjBBfusz164LYZdmgYqBQiidsifDwrpYMbiM1gWpgAiEAjLN+KeJ841HZFg7OADkQb7h0L+dizfW4IHYFzZ9sQ4s="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/inject-js-0.4.14.tgz_1461569029175_0.03586459276266396"},"directories":{}},"0.4.15":{"name":"inject-js","version":"0.4.15","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"bower":"^1.3.12","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-contrib-concat":"^1.0.0","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.0","grunt-contrib-watch":"^0.6.1","grunt-karma":"~0.8.3","jasmine-core":"^2.2.0","karma":"~0.12.31","karma-chrome-launcher":"^0.1.7","karma-coffee-preprocessor":"^0.3.0","karma-coverage":"^0.2.7","karma-firefox-launcher":"^0.1.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.5","karma-phantomjs-launcher":"^0.1.4","karma-sauce-launcher":"~0.1.8","karma-script-launcher":"~0.1.0","karma-story-reporter":"~0.2.2"},"dependencies":{"lodash":"~4.6.1"},"gitHead":"e42c1c11c9224b2f497ae238d9fc3fe5d6a10ae0","_id":"inject-js@0.4.15","scripts":{},"_shasum":"59d7af3d7bbbe14ca682d39c3d9a7d2364aaa841","_from":".","_npmVersion":"2.15.0","_nodeVersion":"4.4.2","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"shasum":"59d7af3d7bbbe14ca682d39c3d9a7d2364aaa841","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.4.15.tgz","integrity":"sha512-yVW2p8kFU0+6W1OKrkjX8c7T4pP/o0klWkNpEtjmvtEYp4L4KvtWWRpoZvj4VMFR+jxxR4eY/kWr9nqikMNKtA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDN9+GGmuvXFmI4mLAdqz4mP4+ivGC2/jofPsp483BgDAiAexa/JRAod9pWggpMfdwC8AofEX/dnFjJrdfLkKLHxpA=="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/inject-js-0.4.15.tgz_1461674147848_0.44042544323019683"},"directories":{}},"0.5.2":{"name":"inject-js","version":"0.5.2","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"assert-js":"^0.18.0","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-istanbul":"^4.1.4","babel-plugin-lodash":"^3.3.2","babel-plugin-ramda":"^1.4.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","babel-preset-es2015-mod":"^6.6.0","babel-preset-es3":"^1.0.1","bower":"^1.8.2","eslint":"^4.17.0","grunt":"^1.0.2","grunt-cli":"^1.2.0","grunt-contrib-concat":"^1.0.1","grunt-contrib-jshint":"~1.1.0","grunt-contrib-uglify":"~3.3.0","grunt-contrib-watch":"^1.0.0","grunt-karma":"~2.0.0","import-loader":"^1.0.1","imports-loader":"^0.7.1","jasmine-core":"^2.99.1","jasmine-sinon":"^0.4.0","karma":"~2.0.0","karma-coverage":"^1.1.1","karma-jasmine":"^1.1.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-webpack":"^2.0.9","lodash-webpack-plugin":"^0.11.4","phantomjs-polyfill-array-from":"^1.0.1","phantomjs-polyfill-object-assign":"0.0.2","ramda":"^0.25.0","sinon":"^4.3.0","webpack":"^3.11.0","webpack-conditional-loader":"^1.0.11"},"dependencies":{"lodash":"^4.17.5"},"readme":"#injectjs\n\na lightweight, small, high level dependency injector with support for object lifetime management\n\n> This software is still not fully baked, at version 0.4, and missing a wealth of functionalities for what constitutes a fully fledged dependency injector\n\nWith that said, I expect to have a fully functional, fully tested, fully decoupled and fully documented version in the next couple of Months. I will greatly appreciate help from early adopters and will gladly embrace feature requests and bug reports uploaded to the issue tracker.\n\n### Table of contents\n\n1. [Why InjectJS](#intro)\n2. [Installation](#install)\n3. [Usage](#use)\n\t1. [The Old Way](#use-old)\n\t2. [InjectJS Hello World](#use-hello-world)\n\t3. [Foo and Bar at a Party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md)\n4. [Roadmap](#road)\n5. [API reference](#api)\n\t1. [Registration Methods](#registration)\n\t\t- [injector.registerType](#registration-type)\n\t\t- [injector.registerProvider](#registration-provider)\n\t\t- [injector.registerMain](#registration-main)\n\t\t- [$inject property](#registration-$inject)\n\t2. [Injection Methods](#injection)\n\t\t- [injector.get](#injection-get)\n\t\t- [injector.inject](#injection-inject)\n\t\t- [injector.run](#injection-run)\n\t3. [Utility Methods](#utility)\n\t\t- [injector.getType](#utility-gettype)\n\t\t- [injector.extend](#utility-extend)\n\t\t- [injector.noConflict](#utility-noConflict)\n\t\t- [injector.removeDefaultListener](#utility-removeDefaultListener)\n\t\t- [injector.clearState](#utility-clearState)\n\t4. [Test Helpers](#testing)\n\t\t- [injector.registerFake](#testing-fakes)\n\t\t- [injector.removeFake](#testing-fakes-remove)\n\t\t- [injector.flushFakes](#testing-fakes-flush)\n\t\t- [injector.harness](#testing-harness)\n\n## <a name=\"intro\"></a> Why InjectJS?\n\nUntil now, the only way to inject dependencies into JavaScript objects has been by manually instantiating them and passing them into the object's constructor, property or method. This creates a load of overhead and boilerplate \"new keyword\" code. Add to that the fact JavaScript is dynamically typed and you have no real way of knowing whether changing the signature of an object's constructor, property or method will cause an error in the rest of your code (unless, of course, you keep track of every place your recently changed object is used and how). You (usually) won't even get a runtime error since JavaScript doesn't complain at all when you pass a function more (or less) arguments than it has parameters. InjectJS aims to get rid of all this. It allows you to wire up your dependencies beforehand and handle instantiation of all your JS objects.\n\n### What about RequireJS?\n\nRequireJS is a wonderful modularization framework, but it is not a dependency injection framework. From my (admittedly limited) experience with RequireJS, what I understand it does is load javascript files as modules which can then be required from other modules. It does a wonderful job at solving the \"everything must be global\" problem that haunts JavaScript from it's beginnings. What RequireJS doesn't (and shouldn't!) do, is provide high level dependency injection and object lifetime management, and that's where InjectJS comes in\n\n\n> Note: InjectJS includes a shim to integrate into RequireJS, and in the near future I expect to use requireJS (along with Grunt) to modularize InjectJS's code into smaller, less complex packages (as opposed to the one large file it is now).\n\n# <a name=\"install\"></a>Installation\n\nSimply download inject.js or inject.min.js from the dist folder and include it into your html page(s), in that order.\n\nYou can also install it using npm `npm install inject-js`\n\n> **Note:** As of version 0.3 InjectJS includes a grunt build process to lint, test, merge and minify all the code into a single inject.js file (and an inject.min.js file, of course). If you want to tinker about with the different aspects of the library simply clone it and look into the src dir.\n\n> **Note:** InjectJS depends on Lodash ([https://lodash.com/](https://lodash.com/)). You can probably use it with underscore as well, but the library is developed and tested using Lodash, so there are no assurances.\n\n## Tests\n\nInjectJS comes with a test suite that fully unit-tests the code. to run it, do the following:\n\n1. clone the repository (or download and extract the auto-generated zip)\n2. run npm install\n3. run bower install\n4. there are three karma config files in Tests: karma.conf.js (runs tests against src), karma.dist.conf.js (runs tests against dist/inject.js) and karma.dist.min.conf.js (runs tests against dist/inject.min.js). The default grunt task will watch the `src` folder and run all tests on all browsers and both dist files.\n\n# <a name=\"use\"></a>Usage\n\nThe main idea behind InjectJS is getting rid of the new keyword in your code. This may seem a controversial statement and impossible to achieve, but it's quite possible and will make your code leaner and more maintainable, or at the very least, less frustrating.\n\n<a name=\"use-old\"></a>Let's start with a Hello World app. Normally you would make a new function called mouth, instantiate somewhere it and then call it:\n\n    function Mouth() {\n        this.say = function (what) {\n            alert(what);\n        }\n    }\n    \n    var mouth = new Mouth();\n    mouth.say('hello world!');\n\nThere are a few problems with this approach:\n\n1. Mouth is global\n2. mouth is global\n3. you need to manually instantiate it to use it\n\n###<a name=\"use-hello-world\"></a> The InjectJS Way\n\nOk, so one global function and one global variable aren't much to worry about, but this is just the hello world example. With InjectJS you start by registering Mouth as a type:\n\n\n\n    injector.registerType('mouth', function () {\n        this.say = function (what) {\n            alert(what);\n        }\n    });\n\nMarvellous... (if only markdown had a descriptor for sarcasm). One good thing happened here though. You now have a mouth type that is no longer global! Next step is to use this newly created type somewhere in your code... how about a main method? you know... the one that runs when the app starts, inside `$(function() {})` or somewhere similar:\n\n    injector.registerMain(function (mouth) {\n        mouth.say('hello world!');\n    });\n    \n    $(function () {\n        injector.run(); // runs the function registered with registerMain\n    });\n\nAs of now, we've gotten rid of the globals, which isn't much of a feat in and of itself, but still noteworthy. More importantly, we no longer have to manually instantiate `Mouth` to use it!\n\nSo now, what if you want to hide the original `Mouth` so it is no longer global? Easy, right?\n\n    (function () {\n        function Mouth() {\n\t        this.say = function (what) {\n\t            alert(what);\n\t        }\n        }\n        \n        var mouth = new Mouth();\n        mouth.say('hello world!');\n    }());\n\nOk, great, now we've just solved two of the three initial problems there were with this code (remember you're still manually instantiating). No need for InjectJS then.\nSo let's complicate things a bit...\n\n> To see the rest of this example, please head to [foo-bar-party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md). to see a more \"real world\" use case scenario, check out the code at [https://github.com/nstraub/snake](https://github.com/nstraub/snake) (still unpolished, but makes heavy use of the functionalities currently available in this framework)`\n\n\n# <a name=\"road\"></a>Roadmap\n\nThe current version, 0.4, has the following features:\n\n- [registering types](#registration-type)\n- [registering providers](#registration-provider)\n- [instantiating types](#injection-get)\n- [running providers within a context](#injection-get)\n- [passive providers](#registration-type-provider)\n- [provider parameters (aka ad hoc dependencies)](#injection-get-adhoc)\n- [injecting types into methods](#injection-inject)\n- [Singleton, Transient, Root, Parent and State lifetimes](#lifetime).\n- Test facilities: [fakes](#testing-fakes) and [harnesses](#testing-harness)\n- Code modularization and Grunt build process.\n\nTo sum it up, it provides basic dependency injection capabilities and the ability to use these dependencies in a test environment.\n\nSo here are the next planned releases:\n\n- 0.5 Preprocessor for dealing with minifiers.\n- 0.6 abstract types\n- 0.7 Property injection.\n- 0.8 Method injection (currying).\n\n# <a name=\"lifetime\"></a>Object Lifetime Management\n\n> **Note:** for a more comprehensive explanation of object lifetime you can visit the [Wikipedia article](https://en.wikipedia.org/wiki/Object_lifetime)\n\nThe main selling point of a DI framework is it manages your objects' lifetime - namely when objects get instantiated and when they get destroyed - so you don't have to.\nAs far as I know, JavaScript doesn't have a DI framework that provides this feature, which is why this library is being developed.\n\nEvery object in your application gets instantiated at some point, and destroyed at some other. there are objects that last for the entire lifecycle of the app and others that get instantiated each and every time you need to use it. In between are a few other lifetimes that restrict the scope of the object they define. Here's a list of lifetimes supported by `inject-js`, in order of their scope restriction:\n\n## Singleton\n\nThe most typical lifetime used in JS is singleton. Think of a module in ES6, an angular service or the jQuery library. Only one instance of the defined type is created throughout the entire page lifecycle.\n\n## State\n\nThe state lifetime is like a singleton, but for a specific state of your application. By default, `inject-js` recognizes the `hashchange` event as a change of state, and clears all state objects when the hash portion of a site is changed. You can change this behaviour by registering the `clearState` method to a custom event and clear the default behaviour by calling the `removeDefaultListener` method.\nAn example of this lifetime would be a data-set. Suppose you have a blog with different tags. The homepage shows a data-set of all your blog entries and whe the user clicks on a tag, the data-set gets replaced with a list scoped to the particular selection.\n\n## Root\n\nEvery object has a dependency graph, i.e. a hierarchy of objects it depends on to perform its desired task. The root lifetime allows you to specify dependencies that will be created once for the entire graph of an object which is not a dependency of another object, and will be reused for every dependency that requires an instance of it.\n\n## Parent\n\nLike root but specified at an arbitrary point in the dependency graph.\n\n## Transient\n\nThis lifetime creates an instance of the object every time it is injected into another object.\n\n# <a name=\"api\"></a>API reference\n\nThe syntax for this framework takes from and expands the syntax used by AngularJS's injector. you register a function with a name as first argument, and then an array of dependencies with the last element being the actual function you want to register as the dependency.\n\n## <a name=\"registration\"></a> Registration Methods\n\n### <a name=\"registration-type\"></a>injector.registerType\n\n>Allows you to register a dependency which can be instantiated by the injector and injected into other registered dependencies and the main function.\n\n**signatures**\n\n*registerType(name, type, [lifetime = 'transient'], [provider]) : void*\n*registerType(name, type: [2-\\*], [lifetime = 'transient'], [provider]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *type (function|array): mandatory*.\n   - When type is a function, its dependencies are inferred from its parameter names.\n   - When type is an array, all items except the last are dependency names for the type, and the last is the actual type, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n- *lifetime (string): optional, default transient*. the type's lifetime, currently supported are *singleton* (only one instance of the type will exist throughout the applications lifecycle), *state* (one instance exists until the application's state changes), and *transient* (every time the type is referred, a new instance is created).\n- <a name=\"registration-type-provider\"></a>*provider (string): optional.* If present, `type` will be passed through the given provider before being injected. It is called `passive provider` because you don't need to actively inject it anywhere.\n\n> **Note:** for now, if you plan on using the default, `transient` lifetime and want to pass in a passive provider, you either need to explicitly specify `'transient'` or pass in `null` as your third parameter.\n\n**example**\n\n    injector.registerType('my-test-type', function () { \n        this.hello = 'world' \n    }, 'singleton'); // only one instance will ever be created.\n\n    injector.registerType('message-logger', function (message) { \n        this.print = function () { \n          console.log('hello, ' + message.hello) \n        }\n    }); will always create a new instance on injection\n\n### <a name=\"registration-provider\"></a>injector.registerProvider\n\nAllows you to register a provider which can be instantiated by the injector and injected into other registered dependencies and the main function. Currently the only difference between this function and registerType is providers are run directly, and aren't newed. in the future, they'll receive info on the context under which they're being executed, as well as any extra parameters passed when they're called.\n\n**signatures**\n\n*registerProvider(name, provider) : void*\n*registerProvider(name, provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n\n\n### <a name=\"registration-main\"></a>injector.registerMain\n\nAllows you to register the provider that gets invoked when `injector.run()` is called. shorthand for `injector.registerProvider('main', [dependencies... function () {}]);`\n\n**signatures**\n\n*registerMain(provider) : void*\n*registerMain(provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type MUST be an array if you plan to minify your code\n\n### <a name=\"registration-$inject\"></a> $inject property\n\nAs an alternative to array notation, you can specify your dependencies as an array in Type.$inject\n\n**example**\n\n    var type = function (dependency) { \n       this.hello = dependency\n    }\n    \n    type.$inject = ['dependency']\n    injector.registerType('my-test-type', type, 'singleton'); \n\n## <a name=\"injection\"></a>Injection Methods\n\n### <a name=\"injection-get\"></a>injector.get\n\ngets a registered type or provider. Not recommended for use other than to replace the new keyword while refactoring legacy code\n\n**signatures**\n*get(name, [context], [ad hoc dependencies]) : object*\n\n**parameters**\n\n- *name(string|array|function): mandatory.*\n\t- If string, the name of the type you want to get.\n\t- If function, the function you wish to get. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to get. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the invoked provider.\n- <a name=\"injection-get-adhoc\"></a>*ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n> **Note:** type **MUST** be an array if you plan to minify your code\n\n\n**example**\n\n    var logger = injector.get('message-logger');\n    logger.print(); // logs 'hello, world' to the console\n\n### <a name=\"injection-inject\"></a>injector.inject\n\ninjects all dependencies into the requested type and returns a provider for said type. Useful when instantiating the same object multiple times, for currying event callbacks, and for testing.\n\n**signatures**\n*inject(name) : object*\n\n**parameters**\n\n- name(string|array|function): mandatory.\n\t- If string, the name of the type you want to inject.\n\t- If function, the function you wish to inject. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to inject. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n\n> **Note**: name **MUST** be an array if you are passing in an anonymous dependency and plan to minify your code\n\n\n**examples**\n\n    var logger_provider = injector.inject('message-logger'),\n        first_logger = logger_provider(),\n        second_logger = logger_provider(); // much faster to instantiate, since the provider has already been built and is ready to use\n        \n    first_logger.print(); // logs 'hello, world' to the console\n    second_logger.print(); // also logs 'hello, world' to the console\n    \n    $('#some-element').click(injector.inject(function (logger) {\n        // this code will be run when the event is called, and logger will be available to log anything that has something to do with the event\n        // for now, the event object won't be available, so its use is limited in this context. This functionality will be introduced in 0.2\n    }));\n\nJasmine test:\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n    \n    describe 'you can inject dependencies here and not worry about setup and teardown', () ->\n        beforeEach(injector.inject(function (logger) {\n            logger.log('starting test')\n        }));\n        \n        afterEach(injector.inject(function (logger) {\n            logger.log('ending test')\n        }));\n\n\n### <a name=\"injection-run\"></a>injector.run\n\nruns the main function.\n\n**signatures**\n\n*run([context], [ad hoc dependencies]) : void*\n\n**parameters**\n\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the `main` provider.\n- *ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n**throws error when no main function is registered**\n\n## <a name=\"utility\"></a>utility methods\n\n### <a name=\"utility-gettype\"></a>injector.getType\n\ngets the type of requested dependency. Useful for checking instanceof and testing constructors for singleton lifetime types (other uses should be avoided).\n\n**signature**\n\n*getType(name) : Type|null*\n\n**parameters**\n\n- *name (string): mandatory*. name of the dependency for which you wish to get the type.\n\n**returns**\n\nthe type or null if no type is found.\n\n### <a name=\"utility-removeDefaultListener\"></a>injector.removeDefaultListener\n\nDe-registers `hashchange` event for clearing state lifetime `types`.\n\n> **Note:** by default, InjectJS assumes your application is changing state (i.e. moving to another area of the application) every time the hash portion of the URL is changed. While this may be the default behaviour for most web sites, and is encouraged by most routers (like `Backbone`'s `routes`, `simrou`, `AngularJS ng-route`'s default behaviour), more and more sites are adopting HTML5 pushstate, and there are quite a few SPA's which don't use the hash at all. for those sites, you should call this method and then register a handler for your particular state change that calls `injector.clearState`\n\n**signature**\n\ninjector.removeDefaultListener()\n\n### <a name=\"utility-clearState\"></a>injector.clearState\n\nClears all `state` lifetime instantiated types.\n\n**signature**\n\ninjector.clearState()\n\n## <a name=\"testing\"></a>Test Helpers\n\nInjectJS currently provides some features to aid in unit testing (tested with jasmine only)\n\n### <a name=\"testing-fakes\"></a>injector.registerFake\n\nregisters a type as a fake.\n\n**signatures**\nsignatures are identical to [registerType](#registration-type)\n\n### <a name=\"testing-fakes-remove\"></a>injector.removeFake\n\nremoves a fake from the fakes collection.\n\n**signature**\n\n*injector.removeFake(name)*\n\n**parameters**\n\n- *name (string): mandatory*. name of the fake you want to remove.\n\n### <a name=\"testing-fakes-flush\"></a>injector.flushFakes\n\nremoves all fakes from the fakes collection. Identical to `injector.fakes = {}`\n\n**signature**\n\n*injector.flushFakes()*\n\n### <a name=\"testing-harness\"></a>injector.harness\n\nidentical to [inject](#injection-inject), but injects dependencies lazily (inject is eager)\n\n**example**\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n\n    describe('running tests with a harness', function () {\n        beforeAll(function () {\n            injector.registerFake('logger', function () {\n                this.log = sinon.spy();\n            });\n        });    \n        \n        afterAll(function () {\n            delete injector.fakes.logger;\n            \n        describe('using inject'), injector.inject(function (logger) {\n            it('passes the actual logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //fails because getType returns the fake\n            });\n        });\n        \n        describe('using harness'), injector.harness(function (logger) {\n            it('passes the fake logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //passes because logger is the fake type\n            });\n        });\n    });\n","readmeFilename":"README.md","gitHead":"a7a5c409663d80920b15a1bebb6f926332cb7213","_id":"inject-js@0.5.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"integrity":"sha512-7NYW5YHYIcdpFAnLCOzJrGx+ql2T2Y6+G7FkvBAqRVbJcLipc206RcBPj9BsQMclKsS3S3Qxo7ZahEC9Fq+sOw==","shasum":"645e8e0d5ff2fccf3aa0e3cb0712956020f1a0eb","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.5.2.tgz","fileCount":5,"unpackedSize":249339,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG7ZT53kAHDV+Hg9fyDGIgdXgUz+/qxd7SIodrLqz5t4AiEA9HcRPV4k8I7bCLlBiYQSZ7uSVV8W48XNjfD+c7f0WAI="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/inject-js_0.5.2_1518674870020_0.16492157017995068"},"_hasShrinkwrap":false},"0.5.3":{"name":"inject-js","version":"0.5.3","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"assert-js":"^0.18.0","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-istanbul":"^4.1.4","babel-plugin-lodash":"^3.3.2","babel-plugin-ramda":"^1.4.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","eslint":"^4.17.0","imports-loader":"^0.7.1","jasmine-core":"^2.99.1","jasmine-sinon":"^0.4.0","karma":"~2.0.0","karma-coverage":"^1.1.1","karma-jasmine":"^1.1.0","karma-phantomjs-launcher":"^1.0.2","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-webpack":"^2.0.9","phantomjs-polyfill-array-from":"^1.0.1","phantomjs-polyfill-object-assign":"0.0.2","ramda":"^0.25.0","sinon":"^4.3.0","webpack":"^3.11.0"},"dependencies":{"lodash":"^4.17.5","injection":"file:src/injection","providers":"file:src/providers","registration":"file:src/registration","testing":"file:src/testing","util":"file:src/util"},"readme":"#injectjs\n\na lightweight, small, high level dependency injector with support for object lifetime management\n\n> This software is still not fully baked, at version 0.4, and missing a wealth of functionalities for what constitutes a fully fledged dependency injector\n\nWith that said, I expect to have a fully functional, fully tested, fully decoupled and fully documented version in the next couple of Months. I will greatly appreciate help from early adopters and will gladly embrace feature requests and bug reports uploaded to the issue tracker.\n\n### Table of contents\n\n1. [Why InjectJS](#intro)\n2. [Installation](#install)\n3. [Usage](#use)\n\t1. [The Old Way](#use-old)\n\t2. [InjectJS Hello World](#use-hello-world)\n\t3. [Foo and Bar at a Party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md)\n4. [Roadmap](#road)\n5. [API reference](#api)\n\t1. [Registration Methods](#registration)\n\t\t- [injector.registerType](#registration-type)\n\t\t- [injector.registerProvider](#registration-provider)\n\t\t- [injector.registerMain](#registration-main)\n\t\t- [$inject property](#registration-$inject)\n\t2. [Injection Methods](#injection)\n\t\t- [injector.get](#injection-get)\n\t\t- [injector.inject](#injection-inject)\n\t\t- [injector.run](#injection-run)\n\t3. [Utility Methods](#utility)\n\t\t- [injector.getType](#utility-gettype)\n\t\t- [injector.extend](#utility-extend)\n\t\t- [injector.noConflict](#utility-noConflict)\n\t\t- [injector.removeDefaultListener](#utility-removeDefaultListener)\n\t\t- [injector.clearState](#utility-clearState)\n\t4. [Test Helpers](#testing)\n\t\t- [injector.registerFake](#testing-fakes)\n\t\t- [injector.removeFake](#testing-fakes-remove)\n\t\t- [injector.flushFakes](#testing-fakes-flush)\n\t\t- [injector.harness](#testing-harness)\n\n## <a name=\"intro\"></a> Why InjectJS?\n\nUntil now, the only way to inject dependencies into JavaScript objects has been by manually instantiating them and passing them into the object's constructor, property or method. This creates a load of overhead and boilerplate \"new keyword\" code. Add to that the fact JavaScript is dynamically typed and you have no real way of knowing whether changing the signature of an object's constructor, property or method will cause an error in the rest of your code (unless, of course, you keep track of every place your recently changed object is used and how). You (usually) won't even get a runtime error since JavaScript doesn't complain at all when you pass a function more (or less) arguments than it has parameters. InjectJS aims to get rid of all this. It allows you to wire up your dependencies beforehand and handle instantiation of all your JS objects.\n\n### What about RequireJS?\n\nRequireJS is a wonderful modularization framework, but it is not a dependency injection framework. From my (admittedly limited) experience with RequireJS, what I understand it does is load javascript files as modules which can then be required from other modules. It does a wonderful job at solving the \"everything must be global\" problem that haunts JavaScript from it's beginnings. What RequireJS doesn't (and shouldn't!) do, is provide high level dependency injection and object lifetime management, and that's where InjectJS comes in\n\n\n> Note: InjectJS includes a shim to integrate into RequireJS, and in the near future I expect to use requireJS (along with Grunt) to modularize InjectJS's code into smaller, less complex packages (as opposed to the one large file it is now).\n\n# <a name=\"install\"></a>Installation\n\nSimply download inject.js or inject.min.js from the dist folder and include it into your html page(s), in that order.\n\nYou can also install it using npm `npm install inject-js`\n\n> **Note:** As of version 0.3 InjectJS includes a grunt build process to lint, test, merge and minify all the code into a single inject.js file (and an inject.min.js file, of course). If you want to tinker about with the different aspects of the library simply clone it and look into the src dir.\n\n> **Note:** InjectJS depends on Lodash ([https://lodash.com/](https://lodash.com/)). You can probably use it with underscore as well, but the library is developed and tested using Lodash, so there are no assurances.\n\n## Tests\n\nInjectJS comes with a test suite that fully unit-tests the code. to run it, do the following:\n\n1. clone the repository (or download and extract the auto-generated zip)\n2. run npm install\n3. run bower install\n4. there are three karma config files in Tests: karma.conf.js (runs tests against src), karma.dist.conf.js (runs tests against dist/inject.js) and karma.dist.min.conf.js (runs tests against dist/inject.min.js). The default grunt task will watch the `src` folder and run all tests on all browsers and both dist files.\n\n# <a name=\"use\"></a>Usage\n\nThe main idea behind InjectJS is getting rid of the new keyword in your code. This may seem a controversial statement and impossible to achieve, but it's quite possible and will make your code leaner and more maintainable, or at the very least, less frustrating.\n\n<a name=\"use-old\"></a>Let's start with a Hello World app. Normally you would make a new function called mouth, instantiate somewhere it and then call it:\n\n    function Mouth() {\n        this.say = function (what) {\n            alert(what);\n        }\n    }\n    \n    var mouth = new Mouth();\n    mouth.say('hello world!');\n\nThere are a few problems with this approach:\n\n1. Mouth is global\n2. mouth is global\n3. you need to manually instantiate it to use it\n\n###<a name=\"use-hello-world\"></a> The InjectJS Way\n\nOk, so one global function and one global variable aren't much to worry about, but this is just the hello world example. With InjectJS you start by registering Mouth as a type:\n\n\n\n    injector.registerType('mouth', function () {\n        this.say = function (what) {\n            alert(what);\n        }\n    });\n\nMarvellous... (if only markdown had a descriptor for sarcasm). One good thing happened here though. You now have a mouth type that is no longer global! Next step is to use this newly created type somewhere in your code... how about a main method? you know... the one that runs when the app starts, inside `$(function() {})` or somewhere similar:\n\n    injector.registerMain(function (mouth) {\n        mouth.say('hello world!');\n    });\n    \n    $(function () {\n        injector.run(); // runs the function registered with registerMain\n    });\n\nAs of now, we've gotten rid of the globals, which isn't much of a feat in and of itself, but still noteworthy. More importantly, we no longer have to manually instantiate `Mouth` to use it!\n\nSo now, what if you want to hide the original `Mouth` so it is no longer global? Easy, right?\n\n    (function () {\n        function Mouth() {\n\t        this.say = function (what) {\n\t            alert(what);\n\t        }\n        }\n        \n        var mouth = new Mouth();\n        mouth.say('hello world!');\n    }());\n\nOk, great, now we've just solved two of the three initial problems there were with this code (remember you're still manually instantiating). No need for InjectJS then.\nSo let's complicate things a bit...\n\n> To see the rest of this example, please head to [foo-bar-party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md). to see a more \"real world\" use case scenario, check out the code at [https://github.com/nstraub/snake](https://github.com/nstraub/snake) (still unpolished, but makes heavy use of the functionalities currently available in this framework)`\n\n\n# <a name=\"road\"></a>Roadmap\n\nThe current version, 0.4, has the following features:\n\n- [registering types](#registration-type)\n- [registering providers](#registration-provider)\n- [instantiating types](#injection-get)\n- [running providers within a context](#injection-get)\n- [passive providers](#registration-type-provider)\n- [provider parameters (aka ad hoc dependencies)](#injection-get-adhoc)\n- [injecting types into methods](#injection-inject)\n- [Singleton, Transient, Root, Parent and State lifetimes](#lifetime).\n- Test facilities: [fakes](#testing-fakes) and [harnesses](#testing-harness)\n- Code modularization and Grunt build process.\n\nTo sum it up, it provides basic dependency injection capabilities and the ability to use these dependencies in a test environment.\n\nSo here are the next planned releases:\n\n- 0.5 Preprocessor for dealing with minifiers.\n- 0.6 abstract types\n- 0.7 Property injection.\n- 0.8 Method injection (currying).\n\n# <a name=\"lifetime\"></a>Object Lifetime Management\n\n> **Note:** for a more comprehensive explanation of object lifetime you can visit the [Wikipedia article](https://en.wikipedia.org/wiki/Object_lifetime)\n\nThe main selling point of a DI framework is it manages your objects' lifetime - namely when objects get instantiated and when they get destroyed - so you don't have to.\nAs far as I know, JavaScript doesn't have a DI framework that provides this feature, which is why this library is being developed.\n\nEvery object in your application gets instantiated at some point, and destroyed at some other. there are objects that last for the entire lifecycle of the app and others that get instantiated each and every time you need to use it. In between are a few other lifetimes that restrict the scope of the object they define. Here's a list of lifetimes supported by `inject-js`, in order of their scope restriction:\n\n## Singleton\n\nThe most typical lifetime used in JS is singleton. Think of a module in ES6, an angular service or the jQuery library. Only one instance of the defined type is created throughout the entire page lifecycle.\n\n## State\n\nThe state lifetime is like a singleton, but for a specific state of your application. By default, `inject-js` recognizes the `hashchange` event as a change of state, and clears all state objects when the hash portion of a site is changed. You can change this behaviour by registering the `clearState` method to a custom event and clear the default behaviour by calling the `removeDefaultListener` method.\nAn example of this lifetime would be a data-set. Suppose you have a blog with different tags. The homepage shows a data-set of all your blog entries and whe the user clicks on a tag, the data-set gets replaced with a list scoped to the particular selection.\n\n## Root\n\nEvery object has a dependency graph, i.e. a hierarchy of objects it depends on to perform its desired task. The root lifetime allows you to specify dependencies that will be created once for the entire graph of an object which is not a dependency of another object, and will be reused for every dependency that requires an instance of it.\n\n## Parent\n\nLike root but specified at an arbitrary point in the dependency graph.\n\n## Transient\n\nThis lifetime creates an instance of the object every time it is injected into another object.\n\n# <a name=\"api\"></a>API reference\n\nThe syntax for this framework takes from and expands the syntax used by AngularJS's injector. you register a function with a name as first argument, and then an array of dependencies with the last element being the actual function you want to register as the dependency.\n\n## <a name=\"registration\"></a> Registration Methods\n\n### <a name=\"registration-type\"></a>injector.registerType\n\n>Allows you to register a dependency which can be instantiated by the injector and injected into other registered dependencies and the main function.\n\n**signatures**\n\n*registerType(name, type, [lifetime = 'transient'], [provider]) : void*\n*registerType(name, type: [2-\\*], [lifetime = 'transient'], [provider]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *type (function|array): mandatory*.\n   - When type is a function, its dependencies are inferred from its parameter names.\n   - When type is an array, all items except the last are dependency names for the type, and the last is the actual type, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n- *lifetime (string): optional, default transient*. the type's lifetime, currently supported are *singleton* (only one instance of the type will exist throughout the applications lifecycle), *state* (one instance exists until the application's state changes), and *transient* (every time the type is referred, a new instance is created).\n- <a name=\"registration-type-provider\"></a>*provider (string): optional.* If present, `type` will be passed through the given provider before being injected. It is called `passive provider` because you don't need to actively inject it anywhere.\n\n> **Note:** for now, if you plan on using the default, `transient` lifetime and want to pass in a passive provider, you either need to explicitly specify `'transient'` or pass in `null` as your third parameter.\n\n**example**\n\n    injector.registerType('my-test-type', function () { \n        this.hello = 'world' \n    }, 'singleton'); // only one instance will ever be created.\n\n    injector.registerType('message-logger', function (message) { \n        this.print = function () { \n          console.log('hello, ' + message.hello) \n        }\n    }); will always create a new instance on injection\n\n### <a name=\"registration-provider\"></a>injector.registerProvider\n\nAllows you to register a provider which can be instantiated by the injector and injected into other registered dependencies and the main function. Currently the only difference between this function and registerType is providers are run directly, and aren't newed. in the future, they'll receive info on the context under which they're being executed, as well as any extra parameters passed when they're called.\n\n**signatures**\n\n*registerProvider(name, provider) : void*\n*registerProvider(name, provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n\n\n### <a name=\"registration-main\"></a>injector.registerMain\n\nAllows you to register the provider that gets invoked when `injector.run()` is called. shorthand for `injector.registerProvider('main', [dependencies... function () {}]);`\n\n**signatures**\n\n*registerMain(provider) : void*\n*registerMain(provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type MUST be an array if you plan to minify your code\n\n### <a name=\"registration-$inject\"></a> $inject property\n\nAs an alternative to array notation, you can specify your dependencies as an array in Type.$inject\n\n**example**\n\n    var type = function (dependency) { \n       this.hello = dependency\n    }\n    \n    type.$inject = ['dependency']\n    injector.registerType('my-test-type', type, 'singleton'); \n\n## <a name=\"injection\"></a>Injection Methods\n\n### <a name=\"injection-get\"></a>injector.get\n\ngets a registered type or provider. Not recommended for use other than to replace the new keyword while refactoring legacy code\n\n**signatures**\n*get(name, [context], [ad hoc dependencies]) : object*\n\n**parameters**\n\n- *name(string|array|function): mandatory.*\n\t- If string, the name of the type you want to get.\n\t- If function, the function you wish to get. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to get. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the invoked provider.\n- <a name=\"injection-get-adhoc\"></a>*ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n> **Note:** type **MUST** be an array if you plan to minify your code\n\n\n**example**\n\n    var logger = injector.get('message-logger');\n    logger.print(); // logs 'hello, world' to the console\n\n### <a name=\"injection-inject\"></a>injector.inject\n\ninjects all dependencies into the requested type and returns a provider for said type. Useful when instantiating the same object multiple times, for currying event callbacks, and for testing.\n\n**signatures**\n*inject(name) : object*\n\n**parameters**\n\n- name(string|array|function): mandatory.\n\t- If string, the name of the type you want to inject.\n\t- If function, the function you wish to inject. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to inject. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n\n> **Note**: name **MUST** be an array if you are passing in an anonymous dependency and plan to minify your code\n\n\n**examples**\n\n    var logger_provider = injector.inject('message-logger'),\n        first_logger = logger_provider(),\n        second_logger = logger_provider(); // much faster to instantiate, since the provider has already been built and is ready to use\n        \n    first_logger.print(); // logs 'hello, world' to the console\n    second_logger.print(); // also logs 'hello, world' to the console\n    \n    $('#some-element').click(injector.inject(function (logger) {\n        // this code will be run when the event is called, and logger will be available to log anything that has something to do with the event\n        // for now, the event object won't be available, so its use is limited in this context. This functionality will be introduced in 0.2\n    }));\n\nJasmine test:\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n    \n    describe 'you can inject dependencies here and not worry about setup and teardown', () ->\n        beforeEach(injector.inject(function (logger) {\n            logger.log('starting test')\n        }));\n        \n        afterEach(injector.inject(function (logger) {\n            logger.log('ending test')\n        }));\n\n\n### <a name=\"injection-run\"></a>injector.run\n\nruns the main function.\n\n**signatures**\n\n*run([context], [ad hoc dependencies]) : void*\n\n**parameters**\n\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the `main` provider.\n- *ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n**throws error when no main function is registered**\n\n## <a name=\"utility\"></a>utility methods\n\n### <a name=\"utility-gettype\"></a>injector.getType\n\ngets the type of requested dependency. Useful for checking instanceof and testing constructors for singleton lifetime types (other uses should be avoided).\n\n**signature**\n\n*getType(name) : Type|null*\n\n**parameters**\n\n- *name (string): mandatory*. name of the dependency for which you wish to get the type.\n\n**returns**\n\nthe type or null if no type is found.\n\n### <a name=\"utility-removeDefaultListener\"></a>injector.removeDefaultListener\n\nDe-registers `hashchange` event for clearing state lifetime `types`.\n\n> **Note:** by default, InjectJS assumes your application is changing state (i.e. moving to another area of the application) every time the hash portion of the URL is changed. While this may be the default behaviour for most web sites, and is encouraged by most routers (like `Backbone`'s `routes`, `simrou`, `AngularJS ng-route`'s default behaviour), more and more sites are adopting HTML5 pushstate, and there are quite a few SPA's which don't use the hash at all. for those sites, you should call this method and then register a handler for your particular state change that calls `injector.clearState`\n\n**signature**\n\ninjector.removeDefaultListener()\n\n### <a name=\"utility-clearState\"></a>injector.clearState\n\nClears all `state` lifetime instantiated types.\n\n**signature**\n\ninjector.clearState()\n\n## <a name=\"testing\"></a>Test Helpers\n\nInjectJS currently provides some features to aid in unit testing (tested with jasmine only)\n\n### <a name=\"testing-fakes\"></a>injector.registerFake\n\nregisters a type as a fake.\n\n**signatures**\nsignatures are identical to [registerType](#registration-type)\n\n### <a name=\"testing-fakes-remove\"></a>injector.removeFake\n\nremoves a fake from the fakes collection.\n\n**signature**\n\n*injector.removeFake(name)*\n\n**parameters**\n\n- *name (string): mandatory*. name of the fake you want to remove.\n\n### <a name=\"testing-fakes-flush\"></a>injector.flushFakes\n\nremoves all fakes from the fakes collection. Identical to `injector.fakes = {}`\n\n**signature**\n\n*injector.flushFakes()*\n\n### <a name=\"testing-harness\"></a>injector.harness\n\nidentical to [inject](#injection-inject), but injects dependencies lazily (inject is eager)\n\n**example**\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n\n    describe('running tests with a harness', function () {\n        beforeAll(function () {\n            injector.registerFake('logger', function () {\n                this.log = sinon.spy();\n            });\n        });    \n        \n        afterAll(function () {\n            delete injector.fakes.logger;\n            \n        describe('using inject'), injector.inject(function (logger) {\n            it('passes the actual logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //fails because getType returns the fake\n            });\n        });\n        \n        describe('using harness'), injector.harness(function (logger) {\n            it('passes the fake logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //passes because logger is the fake type\n            });\n        });\n    });\n","readmeFilename":"README.md","gitHead":"c65546ee454ac9f2e2349f5ce35cc88f8ee5991d","_id":"inject-js@0.5.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"integrity":"sha512-3odZHqpePrFqx/v/7nE8y3CIZy3hg+e6PU4gZvh2yurmavpF+myhbfZ6uKQgfm80CwjIJd6qQGphtgwU6YXZHQ==","shasum":"591070baab9b5574f2b447c8d38117847be0047e","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.5.3.tgz","fileCount":3,"unpackedSize":222444,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDR5kYxQDhK3XZcCjsd6Z5KxFrGBsBtm0Ks7GntG75DTgIgQ/UiBJhtYJQottpI0SWFnHt49LQkFlhMw9hqKrUS0uw="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/inject-js_0.5.3_1518676856633_0.6561069473127104"},"_hasShrinkwrap":false},"0.5.4":{"name":"inject-js","version":"0.5.4","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"assert-js":"^0.18.0","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-istanbul":"^4.1.4","babel-plugin-lodash":"^3.3.2","babel-plugin-ramda":"^1.4.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","eslint":"^4.17.0","imports-loader":"^0.7.1","jasmine-core":"^2.99.1","jasmine-sinon":"^0.4.0","karma":"~2.0.0","karma-coverage":"^1.1.1","karma-jasmine":"^1.1.0","karma-phantomjs-launcher":"^1.0.2","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-webpack":"^2.0.9","phantomjs-polyfill-array-from":"^1.0.1","phantomjs-polyfill-object-assign":"0.0.2","ramda":"^0.25.0","sinon":"^4.3.0","webpack":"^3.11.0"},"dependencies":{"lodash":"^4.17.5"},"readme":"#injectjs\n\na lightweight, small, high level dependency injector with support for object lifetime management\n\n> This software is still not fully baked, at version 0.4, and missing a wealth of functionalities for what constitutes a fully fledged dependency injector\n\nWith that said, I expect to have a fully functional, fully tested, fully decoupled and fully documented version in the next couple of Months. I will greatly appreciate help from early adopters and will gladly embrace feature requests and bug reports uploaded to the issue tracker.\n\n### Table of contents\n\n1. [Why InjectJS](#intro)\n2. [Installation](#install)\n3. [Usage](#use)\n\t1. [The Old Way](#use-old)\n\t2. [InjectJS Hello World](#use-hello-world)\n\t3. [Foo and Bar at a Party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md)\n4. [Roadmap](#road)\n5. [API reference](#api)\n\t1. [Registration Methods](#registration)\n\t\t- [injector.registerType](#registration-type)\n\t\t- [injector.registerProvider](#registration-provider)\n\t\t- [injector.registerMain](#registration-main)\n\t\t- [$inject property](#registration-$inject)\n\t2. [Injection Methods](#injection)\n\t\t- [injector.get](#injection-get)\n\t\t- [injector.inject](#injection-inject)\n\t\t- [injector.run](#injection-run)\n\t3. [Utility Methods](#utility)\n\t\t- [injector.getType](#utility-gettype)\n\t\t- [injector.extend](#utility-extend)\n\t\t- [injector.noConflict](#utility-noConflict)\n\t\t- [injector.removeDefaultListener](#utility-removeDefaultListener)\n\t\t- [injector.clearState](#utility-clearState)\n\t4. [Test Helpers](#testing)\n\t\t- [injector.registerFake](#testing-fakes)\n\t\t- [injector.removeFake](#testing-fakes-remove)\n\t\t- [injector.flushFakes](#testing-fakes-flush)\n\t\t- [injector.harness](#testing-harness)\n\n## <a name=\"intro\"></a> Why InjectJS?\n\nUntil now, the only way to inject dependencies into JavaScript objects has been by manually instantiating them and passing them into the object's constructor, property or method. This creates a load of overhead and boilerplate \"new keyword\" code. Add to that the fact JavaScript is dynamically typed and you have no real way of knowing whether changing the signature of an object's constructor, property or method will cause an error in the rest of your code (unless, of course, you keep track of every place your recently changed object is used and how). You (usually) won't even get a runtime error since JavaScript doesn't complain at all when you pass a function more (or less) arguments than it has parameters. InjectJS aims to get rid of all this. It allows you to wire up your dependencies beforehand and handle instantiation of all your JS objects.\n\n### What about RequireJS?\n\nRequireJS is a wonderful modularization framework, but it is not a dependency injection framework. From my (admittedly limited) experience with RequireJS, what I understand it does is load javascript files as modules which can then be required from other modules. It does a wonderful job at solving the \"everything must be global\" problem that haunts JavaScript from it's beginnings. What RequireJS doesn't (and shouldn't!) do, is provide high level dependency injection and object lifetime management, and that's where InjectJS comes in\n\n\n> Note: InjectJS includes a shim to integrate into RequireJS, and in the near future I expect to use requireJS (along with Grunt) to modularize InjectJS's code into smaller, less complex packages (as opposed to the one large file it is now).\n\n# <a name=\"install\"></a>Installation\n\nSimply download inject.js or inject.min.js from the dist folder and include it into your html page(s), in that order.\n\nYou can also install it using npm `npm install inject-js`\n\n> **Note:** As of version 0.3 InjectJS includes a grunt build process to lint, test, merge and minify all the code into a single inject.js file (and an inject.min.js file, of course). If you want to tinker about with the different aspects of the library simply clone it and look into the src dir.\n\n> **Note:** InjectJS depends on Lodash ([https://lodash.com/](https://lodash.com/)). You can probably use it with underscore as well, but the library is developed and tested using Lodash, so there are no assurances.\n\n## Tests\n\nInjectJS comes with a test suite that fully unit-tests the code. to run it, do the following:\n\n1. clone the repository (or download and extract the auto-generated zip)\n2. run npm install\n3. run bower install\n4. there are three karma config files in Tests: karma.conf.js (runs tests against src), karma.dist.conf.js (runs tests against dist/inject.js) and karma.dist.min.conf.js (runs tests against dist/inject.min.js). The default grunt task will watch the `src` folder and run all tests on all browsers and both dist files.\n\n# <a name=\"use\"></a>Usage\n\nThe main idea behind InjectJS is getting rid of the new keyword in your code. This may seem a controversial statement and impossible to achieve, but it's quite possible and will make your code leaner and more maintainable, or at the very least, less frustrating.\n\n<a name=\"use-old\"></a>Let's start with a Hello World app. Normally you would make a new function called mouth, instantiate somewhere it and then call it:\n\n    function Mouth() {\n        this.say = function (what) {\n            alert(what);\n        }\n    }\n    \n    var mouth = new Mouth();\n    mouth.say('hello world!');\n\nThere are a few problems with this approach:\n\n1. Mouth is global\n2. mouth is global\n3. you need to manually instantiate it to use it\n\n###<a name=\"use-hello-world\"></a> The InjectJS Way\n\nOk, so one global function and one global variable aren't much to worry about, but this is just the hello world example. With InjectJS you start by registering Mouth as a type:\n\n\n\n    injector.registerType('mouth', function () {\n        this.say = function (what) {\n            alert(what);\n        }\n    });\n\nMarvellous... (if only markdown had a descriptor for sarcasm). One good thing happened here though. You now have a mouth type that is no longer global! Next step is to use this newly created type somewhere in your code... how about a main method? you know... the one that runs when the app starts, inside `$(function() {})` or somewhere similar:\n\n    injector.registerMain(function (mouth) {\n        mouth.say('hello world!');\n    });\n    \n    $(function () {\n        injector.run(); // runs the function registered with registerMain\n    });\n\nAs of now, we've gotten rid of the globals, which isn't much of a feat in and of itself, but still noteworthy. More importantly, we no longer have to manually instantiate `Mouth` to use it!\n\nSo now, what if you want to hide the original `Mouth` so it is no longer global? Easy, right?\n\n    (function () {\n        function Mouth() {\n\t        this.say = function (what) {\n\t            alert(what);\n\t        }\n        }\n        \n        var mouth = new Mouth();\n        mouth.say('hello world!');\n    }());\n\nOk, great, now we've just solved two of the three initial problems there were with this code (remember you're still manually instantiating). No need for InjectJS then.\nSo let's complicate things a bit...\n\n> To see the rest of this example, please head to [foo-bar-party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md). to see a more \"real world\" use case scenario, check out the code at [https://github.com/nstraub/snake](https://github.com/nstraub/snake) (still unpolished, but makes heavy use of the functionalities currently available in this framework)`\n\n\n# <a name=\"road\"></a>Roadmap\n\nThe current version, 0.4, has the following features:\n\n- [registering types](#registration-type)\n- [registering providers](#registration-provider)\n- [instantiating types](#injection-get)\n- [running providers within a context](#injection-get)\n- [passive providers](#registration-type-provider)\n- [provider parameters (aka ad hoc dependencies)](#injection-get-adhoc)\n- [injecting types into methods](#injection-inject)\n- [Singleton, Transient, Root, Parent and State lifetimes](#lifetime).\n- Test facilities: [fakes](#testing-fakes) and [harnesses](#testing-harness)\n- Code modularization and Grunt build process.\n\nTo sum it up, it provides basic dependency injection capabilities and the ability to use these dependencies in a test environment.\n\nSo here are the next planned releases:\n\n- 0.5 Preprocessor for dealing with minifiers.\n- 0.6 abstract types\n- 0.7 Property injection.\n- 0.8 Method injection (currying).\n\n# <a name=\"lifetime\"></a>Object Lifetime Management\n\n> **Note:** for a more comprehensive explanation of object lifetime you can visit the [Wikipedia article](https://en.wikipedia.org/wiki/Object_lifetime)\n\nThe main selling point of a DI framework is it manages your objects' lifetime - namely when objects get instantiated and when they get destroyed - so you don't have to.\nAs far as I know, JavaScript doesn't have a DI framework that provides this feature, which is why this library is being developed.\n\nEvery object in your application gets instantiated at some point, and destroyed at some other. there are objects that last for the entire lifecycle of the app and others that get instantiated each and every time you need to use it. In between are a few other lifetimes that restrict the scope of the object they define. Here's a list of lifetimes supported by `inject-js`, in order of their scope restriction:\n\n## Singleton\n\nThe most typical lifetime used in JS is singleton. Think of a module in ES6, an angular service or the jQuery library. Only one instance of the defined type is created throughout the entire page lifecycle.\n\n## State\n\nThe state lifetime is like a singleton, but for a specific state of your application. By default, `inject-js` recognizes the `hashchange` event as a change of state, and clears all state objects when the hash portion of a site is changed. You can change this behaviour by registering the `clearState` method to a custom event and clear the default behaviour by calling the `removeDefaultListener` method.\nAn example of this lifetime would be a data-set. Suppose you have a blog with different tags. The homepage shows a data-set of all your blog entries and whe the user clicks on a tag, the data-set gets replaced with a list scoped to the particular selection.\n\n## Root\n\nEvery object has a dependency graph, i.e. a hierarchy of objects it depends on to perform its desired task. The root lifetime allows you to specify dependencies that will be created once for the entire graph of an object which is not a dependency of another object, and will be reused for every dependency that requires an instance of it.\n\n## Parent\n\nLike root but specified at an arbitrary point in the dependency graph.\n\n## Transient\n\nThis lifetime creates an instance of the object every time it is injected into another object.\n\n# <a name=\"api\"></a>API reference\n\nThe syntax for this framework takes from and expands the syntax used by AngularJS's injector. you register a function with a name as first argument, and then an array of dependencies with the last element being the actual function you want to register as the dependency.\n\n## <a name=\"registration\"></a> Registration Methods\n\n### <a name=\"registration-type\"></a>injector.registerType\n\n>Allows you to register a dependency which can be instantiated by the injector and injected into other registered dependencies and the main function.\n\n**signatures**\n\n*registerType(name, type, [lifetime = 'transient'], [provider]) : void*\n*registerType(name, type: [2-\\*], [lifetime = 'transient'], [provider]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *type (function|array): mandatory*.\n   - When type is a function, its dependencies are inferred from its parameter names.\n   - When type is an array, all items except the last are dependency names for the type, and the last is the actual type, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n- *lifetime (string): optional, default transient*. the type's lifetime, currently supported are *singleton* (only one instance of the type will exist throughout the applications lifecycle), *state* (one instance exists until the application's state changes), and *transient* (every time the type is referred, a new instance is created).\n- <a name=\"registration-type-provider\"></a>*provider (string): optional.* If present, `type` will be passed through the given provider before being injected. It is called `passive provider` because you don't need to actively inject it anywhere.\n\n> **Note:** for now, if you plan on using the default, `transient` lifetime and want to pass in a passive provider, you either need to explicitly specify `'transient'` or pass in `null` as your third parameter.\n\n**example**\n\n    injector.registerType('my-test-type', function () { \n        this.hello = 'world' \n    }, 'singleton'); // only one instance will ever be created.\n\n    injector.registerType('message-logger', function (message) { \n        this.print = function () { \n          console.log('hello, ' + message.hello) \n        }\n    }); will always create a new instance on injection\n\n### <a name=\"registration-provider\"></a>injector.registerProvider\n\nAllows you to register a provider which can be instantiated by the injector and injected into other registered dependencies and the main function. Currently the only difference between this function and registerType is providers are run directly, and aren't newed. in the future, they'll receive info on the context under which they're being executed, as well as any extra parameters passed when they're called.\n\n**signatures**\n\n*registerProvider(name, provider) : void*\n*registerProvider(name, provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n\n\n### <a name=\"registration-main\"></a>injector.registerMain\n\nAllows you to register the provider that gets invoked when `injector.run()` is called. shorthand for `injector.registerProvider('main', [dependencies... function () {}]);`\n\n**signatures**\n\n*registerMain(provider) : void*\n*registerMain(provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type MUST be an array if you plan to minify your code\n\n### <a name=\"registration-$inject\"></a> $inject property\n\nAs an alternative to array notation, you can specify your dependencies as an array in Type.$inject\n\n**example**\n\n    var type = function (dependency) { \n       this.hello = dependency\n    }\n    \n    type.$inject = ['dependency']\n    injector.registerType('my-test-type', type, 'singleton'); \n\n## <a name=\"injection\"></a>Injection Methods\n\n### <a name=\"injection-get\"></a>injector.get\n\ngets a registered type or provider. Not recommended for use other than to replace the new keyword while refactoring legacy code\n\n**signatures**\n*get(name, [context], [ad hoc dependencies]) : object*\n\n**parameters**\n\n- *name(string|array|function): mandatory.*\n\t- If string, the name of the type you want to get.\n\t- If function, the function you wish to get. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to get. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the invoked provider.\n- <a name=\"injection-get-adhoc\"></a>*ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n> **Note:** type **MUST** be an array if you plan to minify your code\n\n\n**example**\n\n    var logger = injector.get('message-logger');\n    logger.print(); // logs 'hello, world' to the console\n\n### <a name=\"injection-inject\"></a>injector.inject\n\ninjects all dependencies into the requested type and returns a provider for said type. Useful when instantiating the same object multiple times, for currying event callbacks, and for testing.\n\n**signatures**\n*inject(name) : object*\n\n**parameters**\n\n- name(string|array|function): mandatory.\n\t- If string, the name of the type you want to inject.\n\t- If function, the function you wish to inject. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to inject. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n\n> **Note**: name **MUST** be an array if you are passing in an anonymous dependency and plan to minify your code\n\n\n**examples**\n\n    var logger_provider = injector.inject('message-logger'),\n        first_logger = logger_provider(),\n        second_logger = logger_provider(); // much faster to instantiate, since the provider has already been built and is ready to use\n        \n    first_logger.print(); // logs 'hello, world' to the console\n    second_logger.print(); // also logs 'hello, world' to the console\n    \n    $('#some-element').click(injector.inject(function (logger) {\n        // this code will be run when the event is called, and logger will be available to log anything that has something to do with the event\n        // for now, the event object won't be available, so its use is limited in this context. This functionality will be introduced in 0.2\n    }));\n\nJasmine test:\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n    \n    describe 'you can inject dependencies here and not worry about setup and teardown', () ->\n        beforeEach(injector.inject(function (logger) {\n            logger.log('starting test')\n        }));\n        \n        afterEach(injector.inject(function (logger) {\n            logger.log('ending test')\n        }));\n\n\n### <a name=\"injection-run\"></a>injector.run\n\nruns the main function.\n\n**signatures**\n\n*run([context], [ad hoc dependencies]) : void*\n\n**parameters**\n\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the `main` provider.\n- *ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n**throws error when no main function is registered**\n\n## <a name=\"utility\"></a>utility methods\n\n### <a name=\"utility-gettype\"></a>injector.getType\n\ngets the type of requested dependency. Useful for checking instanceof and testing constructors for singleton lifetime types (other uses should be avoided).\n\n**signature**\n\n*getType(name) : Type|null*\n\n**parameters**\n\n- *name (string): mandatory*. name of the dependency for which you wish to get the type.\n\n**returns**\n\nthe type or null if no type is found.\n\n### <a name=\"utility-removeDefaultListener\"></a>injector.removeDefaultListener\n\nDe-registers `hashchange` event for clearing state lifetime `types`.\n\n> **Note:** by default, InjectJS assumes your application is changing state (i.e. moving to another area of the application) every time the hash portion of the URL is changed. While this may be the default behaviour for most web sites, and is encouraged by most routers (like `Backbone`'s `routes`, `simrou`, `AngularJS ng-route`'s default behaviour), more and more sites are adopting HTML5 pushstate, and there are quite a few SPA's which don't use the hash at all. for those sites, you should call this method and then register a handler for your particular state change that calls `injector.clearState`\n\n**signature**\n\ninjector.removeDefaultListener()\n\n### <a name=\"utility-clearState\"></a>injector.clearState\n\nClears all `state` lifetime instantiated types.\n\n**signature**\n\ninjector.clearState()\n\n## <a name=\"testing\"></a>Test Helpers\n\nInjectJS currently provides some features to aid in unit testing (tested with jasmine only)\n\n### <a name=\"testing-fakes\"></a>injector.registerFake\n\nregisters a type as a fake.\n\n**signatures**\nsignatures are identical to [registerType](#registration-type)\n\n### <a name=\"testing-fakes-remove\"></a>injector.removeFake\n\nremoves a fake from the fakes collection.\n\n**signature**\n\n*injector.removeFake(name)*\n\n**parameters**\n\n- *name (string): mandatory*. name of the fake you want to remove.\n\n### <a name=\"testing-fakes-flush\"></a>injector.flushFakes\n\nremoves all fakes from the fakes collection. Identical to `injector.fakes = {}`\n\n**signature**\n\n*injector.flushFakes()*\n\n### <a name=\"testing-harness\"></a>injector.harness\n\nidentical to [inject](#injection-inject), but injects dependencies lazily (inject is eager)\n\n**example**\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n\n    describe('running tests with a harness', function () {\n        beforeAll(function () {\n            injector.registerFake('logger', function () {\n                this.log = sinon.spy();\n            });\n        });    \n        \n        afterAll(function () {\n            delete injector.fakes.logger;\n            \n        describe('using inject'), injector.inject(function (logger) {\n            it('passes the actual logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //fails because getType returns the fake\n            });\n        });\n        \n        describe('using harness'), injector.harness(function (logger) {\n            it('passes the fake logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //passes because logger is the fake type\n            });\n        });\n    });\n","readmeFilename":"README.md","gitHead":"7aef8ea42d21de7bc649fbca062b9396f2c3dd12","_id":"inject-js@0.5.4","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"integrity":"sha512-cun9my3ppfRF5zSn3XKST6DqZJQNpdSmVfLm62gJ3M3zsoVIe+Qu0K03nN5FZLFhX70rkVMvBPVc1kmDrtn9Rg==","shasum":"8fa7b46c2aba99075ba055c093b341ad4886c911","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.5.4.tgz","fileCount":3,"unpackedSize":222257,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRPqC3kUpELeTkzCTnFhGbFqPJ2Z4ertY1/XXs495mwQIgO/cTSyj5EYLfknug3nEHZ4T4z/ntCTYdaqdL1mIFHno="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/inject-js_0.5.4_1518677010980_0.41708010887122415"},"_hasShrinkwrap":false},"0.5.6":{"name":"inject-js","version":"0.5.6","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","files":["dist"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"assert-js":"^0.18.0","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-istanbul":"^4.1.4","babel-plugin-lodash":"^3.3.2","babel-plugin-ramda":"^1.4.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","eslint":"^4.17.0","imports-loader":"^0.7.1","jasmine-core":"^2.99.1","jasmine-sinon":"^0.4.0","karma":"~2.0.0","karma-coverage":"^1.1.1","karma-jasmine":"^1.1.0","karma-phantomjs-launcher":"^1.0.2","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-webpack":"^2.0.9","phantomjs-polyfill-array-from":"^1.0.1","phantomjs-polyfill-object-assign":"0.0.2","ramda":"^0.25.0","testable-js":"0.0.17","testdouble":"^3.5.0","webpack":"^3.11.0"},"dependencies":{"lodash":"^4.17.5"},"gitHead":"782115898e3485d298411bd5e0f51beb33735ff1","_id":"inject-js@0.5.6","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"integrity":"sha512-dTnLcjVpRSW09FdS1bp2K7wfcF5rSi8o9FhzInvhKdtE2Bno/AZHm9w1Gru3/E60nvQs8S5lvt2N74+5Sv2MnA==","shasum":"ca1a8462b138af78c02605346176ecfc82e60ac3","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.5.6.tgz","fileCount":3,"unpackedSize":198837,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNUuheQ+m06YQEaxbnojXV2DGE109hnXzIeOwXe5QjAQIgLFZF3GflNoWVYhnwTWiZmhkby51eFHuuixldAPHPvl4="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/inject-js_0.5.6_1519324748428_0.3806413992852147"},"_hasShrinkwrap":false},"0.5.7":{"name":"inject-js","version":"0.5.7","description":"lightweight, small, high level dependency injector with object lifetime management","main":"dist/inject.js","repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"author":{"name":"Nicolas Straub"},"license":"ISC","bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"homepage":"https://github.com/nstraub/injectjs","devDependencies":{"assert-js":"^0.18.0","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-istanbul":"^4.1.4","babel-plugin-lodash":"^3.3.2","babel-plugin-ramda":"^1.4.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","eslint":"^4.17.0","imports-loader":"^0.7.1","jasmine-core":"^2.99.1","jasmine-sinon":"^0.4.0","karma":"~2.0.0","karma-coverage":"^1.1.1","karma-jasmine":"^1.1.0","karma-phantomjs-launcher":"^1.0.2","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-webpack":"^2.0.9","phantomjs-polyfill-array-from":"^1.0.1","phantomjs-polyfill-object-assign":"0.0.2","testable-js":"0.0.17","testdouble":"^3.5.0","webpack":"^3.11.0"},"dependencies":{"lodash":"^4.17.5","ramda":"^0.25.0"},"gitHead":"8c3af275c0294c22e8a7c7a787f204f56d0c5ef6","_id":"inject-js@0.5.7","_npmVersion":"6.4.1","_nodeVersion":"10.14.2","_npmUser":{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"},"dist":{"integrity":"sha512-jEPnrS9QKBpDjsD8V8de38IycNzokyrq11mTR9x+RWMczRbQtghusIo7bwz5Ubgn4RMHqfqIZkCK5399SC44ng==","shasum":"03ee1aa9031a2b039b3aef684a0053beaff6dc40","tarball":"https://registry.npmjs.org/inject-js/-/inject-js-0.5.7.tgz","fileCount":3,"unpackedSize":198836,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZz7qCRA9TVsSAnZWagAAkW4QAJH96tu/rp0A3zpVBvQz\nrjAt+rweS8hQ6colUxvna7Z1vgUwD3Eyx2haSLG1Smt7+oJ/MK4zgYyMhr95\n4Cbk6Kmz91BaK/PyUhyavRF4PTnOkIQS5MTynMynRdGNDedE8P1qqjTYvRcg\n5RsHRqRz81Vr6QW5g1ynA5uJPigBmed3sJa2lZLyUJGAY5Jy8k0JT9FTfMwg\nLU3jQjc5bF/qIM5NX7dv8YgRoEHLBYFgQwWSQQ79tEKzWPahodNnzJlcI1NS\nGZng8HIT8+iDATmbFXJeW4VNbUkXaDQwCZVk82qSR+/kqox8qNhOq7tw5pKC\nm7Pw7cqHBEtZe/ClGkkZOUR7XqequS2A24GgyDccdgK4GjCtmB0NQWA7nzKS\nA+3pLaVUbV7/HluWQ9i/9EkRetE+OLgjJF/4R/7997PBHPErQisqMaxDb5Xp\natMQu4vBsnlExa3KrKT6AsvNWGLb0aVbvApzhJ8Uc6/7uHFY7wJtEoVavsOE\nebea4hvLQDl+a1WUTm2zZaIhFYxOI9QcLeBoUISIuGJFeI369FlJiF1zzOW3\nl+jyWhgmMXVx/88eSyJ9DMcc+1vKg7kq2fL9IIkUxQ4ph7BGik7EOLSgcCwI\njOn4WUE3r0rXcuyBfRLX4gR/Tc5S+VABiCK3vmjbTblUDFdEYHA5C1hQTSWL\nkunH\r\n=qPD1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTLdGy3P3fJlgjYFzUdi+uXzsX1RrbO6mj6HvMSqe9pAiEA5Fq6O6MFjb878uiNqvJCtM6iLXqFeDiMplMAx9oVaWs="}]},"maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/inject-js_0.5.7_1550270186088_0.12028445001866372"},"_hasShrinkwrap":false}},"readme":"#injectjs\n\na lightweight, small, high level dependency injector with support for object lifetime management\n\n> This software is still not fully baked, at version 0.4, and missing a wealth of functionalities for what constitutes a fully fledged dependency injector\n\nWith that said, I expect to have a fully functional, fully tested, fully decoupled and fully documented version in the next couple of Months. I will greatly appreciate help from early adopters and will gladly embrace feature requests and bug reports uploaded to the issue tracker.\n\n### Table of contents\n\n1. [Why InjectJS](#intro)\n2. [Installation](#install)\n3. [Usage](#use)\n\t1. [The Old Way](#use-old)\n\t2. [InjectJS Hello World](#use-hello-world)\n\t3. [Foo and Bar at a Party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md)\n4. [Roadmap](#road)\n5. [API reference](#api)\n\t1. [Registration Methods](#registration)\n\t\t- [injector.registerType](#registration-type)\n\t\t- [injector.registerProvider](#registration-provider)\n\t\t- [injector.registerMain](#registration-main)\n\t\t- [$inject property](#registration-$inject)\n\t2. [Injection Methods](#injection)\n\t\t- [injector.get](#injection-get)\n\t\t- [injector.inject](#injection-inject)\n\t\t- [injector.run](#injection-run)\n\t3. [Utility Methods](#utility)\n\t\t- [injector.getType](#utility-gettype)\n\t\t- [injector.extend](#utility-extend)\n\t\t- [injector.noConflict](#utility-noConflict)\n\t\t- [injector.removeDefaultListener](#utility-removeDefaultListener)\n\t\t- [injector.clearState](#utility-clearState)\n\t4. [Test Helpers](#testing)\n\t\t- [injector.registerFake](#testing-fakes)\n\t\t- [injector.removeFake](#testing-fakes-remove)\n\t\t- [injector.flushFakes](#testing-fakes-flush)\n\t\t- [injector.harness](#testing-harness)\n\n## <a name=\"intro\"></a> Why InjectJS?\n\nUntil now, the only way to inject dependencies into JavaScript objects has been by manually instantiating them and passing them into the object's constructor, property or method. This creates a load of overhead and boilerplate \"new keyword\" code. Add to that the fact JavaScript is dynamically typed and you have no real way of knowing whether changing the signature of an object's constructor, property or method will cause an error in the rest of your code (unless, of course, you keep track of every place your recently changed object is used and how). You (usually) won't even get a runtime error since JavaScript doesn't complain at all when you pass a function more (or less) arguments than it has parameters. InjectJS aims to get rid of all this. It allows you to wire up your dependencies beforehand and handle instantiation of all your JS objects.\n\n### What about RequireJS / ES6 imports / CommonJS / AMD?\n\nThese are all modularization solutions, not dependency injection solutions. They introduce a sorely needed feature into the language, namely, the ability to create modules and not have all your code live in the global namespace, which gets polluted fairly quickly. What they don't (and shouldn't!) do, is provide high level dependency injection and object lifetime management. That's where InjectJS comes in!\n\n\n# <a name=\"install\"></a>Installation\n\nSimply download inject.js or inject.min.js from the dist folder and include it into your html page(s), in that order.\n\nYou can also install it using npm `npm install inject-js`\n\n> **Note:** As of version 0.3 InjectJS includes a grunt build process to lint, test, merge and minify all the code into a single inject.js file (and an inject.min.js file, of course). If you want to tinker about with the different aspects of the library simply clone it and look into the src dir.\n\n> **Note:** InjectJS depends on Lodash ([https://lodash.com/](https://lodash.com/)). You can probably use it with underscore as well, but the library is developed and tested using Lodash, so there are no assurances.\n\n## Tests\n\nInjectJS comes with a test suite that fully unit-tests the code. to run it, do the following:\n\n1. clone the repository (or download and extract the auto-generated zip)\n2. run npm install\n3. run bower install\n4. there are three karma config files in Tests: karma.conf.js (runs tests against src), karma.dist.conf.js (runs tests against dist/inject.js) and karma.dist.min.conf.js (runs tests against dist/inject.min.js). The default grunt task will watch the `src` folder and run all tests on all browsers and both dist files.\n\n# <a name=\"use\"></a>Usage\n\nThe main idea behind InjectJS is getting rid of the new keyword in your code. This may seem a controversial statement and impossible to achieve, but it's quite possible and will make your code leaner and more maintainable, or at the very least, less frustrating.\n\n<a name=\"use-old\"></a>Let's start with a Hello World app. Normally you would make a new function called mouth, instantiate somewhere it and then call it:\n\n    function Mouth() {\n        this.say = function (what) {\n            alert(what);\n        }\n    }\n    \n    var mouth = new Mouth();\n    mouth.say('hello world!');\n\nThere are a few problems with this approach:\n\n1. Mouth is global\n2. mouth is global\n3. you need to manually instantiate it to use it\n\n###<a name=\"use-hello-world\"></a> The InjectJS Way\n\nOk, so one global function and one global variable aren't much to worry about, but this is just the hello world example. With InjectJS you start by registering Mouth as a type:\n\n\n\n    injector.registerType('mouth', function () {\n        this.say = function (what) {\n            alert(what);\n        }\n    });\n\nMarvellous... (if only markdown had a descriptor for sarcasm). One good thing happened here though. You now have a mouth type that is no longer global! Next step is to use this newly created type somewhere in your code... how about a main method? you know... the one that runs when the app starts, inside `$(function() {})` or somewhere similar:\n\n    injector.registerMain(function (mouth) {\n        mouth.say('hello world!');\n    });\n    \n    $(function () {\n        injector.run(); // runs the function registered with registerMain\n    });\n\nAs of now, we've gotten rid of the globals, which isn't much of a feat in and of itself, but still noteworthy. More importantly, we no longer have to manually instantiate `Mouth` to use it!\n\nSo now, what if you want to hide the original `Mouth` so it is no longer global? Easy, right?\n\n    (function () {\n        function Mouth() {\n\t        this.say = function (what) {\n\t            alert(what);\n\t        }\n        }\n        \n        var mouth = new Mouth();\n        mouth.say('hello world!');\n    }());\n\nOk, great, now we've just solved two of the three initial problems there were with this code (remember you're still manually instantiating). No need for InjectJS then.\nSo let's complicate things a bit...\n\n> To see the rest of this example, please head to [foo-bar-party](https://github.com/nstraub/injectjs/tree/master/Samples/FooBarParty/README.md). to see a more \"real world\" use case scenario, check out the code at [https://github.com/nstraub/snake](https://github.com/nstraub/snake) (still unpolished, but makes heavy use of the functionalities currently available in this framework)`\n\n\n# <a name=\"road\"></a>Roadmap\n\nThe current version, 0.4, has the following features:\n\n- [registering types](#registration-type)\n- [registering providers](#registration-provider)\n- [instantiating types](#injection-get)\n- [running providers within a context](#injection-get)\n- [passive providers](#registration-type-provider)\n- [provider parameters (aka ad hoc dependencies)](#injection-get-adhoc)\n- [injecting types into methods](#injection-inject)\n- [Singleton, Transient, Root, Parent and State lifetimes](#lifetime).\n- Test facilities: [fakes](#testing-fakes) and [harnesses](#testing-harness)\n- Code modularization and Grunt build process.\n\nTo sum it up, it provides basic dependency injection capabilities and the ability to use these dependencies in a test environment.\n\nSo here are the next planned releases:\n\n- 0.5 Preprocessor for dealing with minifiers.\n- 0.6 abstract types\n- 0.7 Property injection.\n- 0.8 Method injection (currying).\n\n# <a name=\"lifetime\"></a>Object Lifetime Management\n\n> **Note:** for a more comprehensive explanation of object lifetime you can visit the [Wikipedia article](https://en.wikipedia.org/wiki/Object_lifetime)\n\nThe main selling point of a DI framework is it manages your objects' lifetime - namely when objects get instantiated and when they get destroyed - so you don't have to.\nAs far as I know, JavaScript doesn't have a DI framework that provides this feature, which is why this library is being developed.\n\nEvery object in your application gets instantiated at some point, and destroyed at some other. there are objects that last for the entire lifecycle of the app and others that get instantiated each and every time you need to use it. In between are a few other lifetimes that restrict the scope of the object they define. Here's a list of lifetimes supported by `inject-js`, in order of their scope restriction:\n\n## Singleton\n\nThe most typical lifetime used in JS is singleton. Think of a module in ES6, an angular service or the jQuery library. Only one instance of the defined type is created throughout the entire page lifecycle.\n\n## State\n\nThe state lifetime is like a singleton, but for a specific state of your application. By default, `inject-js` recognizes the `hashchange` event as a change of state, and clears all state objects when the hash portion of a site is changed. You can change this behaviour by registering the `clearState` method to a custom event and clear the default behaviour by calling the `removeDefaultListener` method.\nAn example of this lifetime would be a data-set. Suppose you have a blog with different tags. The homepage shows a data-set of all your blog entries and whe the user clicks on a tag, the data-set gets replaced with a list scoped to the particular selection.\n\n## Root\n\nEvery object has a dependency graph, i.e. a hierarchy of objects it depends on to perform its desired task. The root lifetime allows you to specify dependencies that will be created once for the entire graph of an object which is not a dependency of another object, and will be reused for every dependency that requires an instance of it.\n\n## Parent\n\nLike root but specified at an arbitrary point in the dependency graph.\n\n## Transient\n\nThis lifetime creates an instance of the object every time it is injected into another object.\n\n# <a name=\"api\"></a>API reference\n\nThe syntax for this framework takes from and expands the syntax used by AngularJS's injector. you register a function with a name as first argument, and then an array of dependencies with the last element being the actual function you want to register as the dependency.\n\n## <a name=\"registration\"></a> Registration Methods\n\n### <a name=\"registration-type\"></a>injector.registerType\n\n>Allows you to register a dependency which can be instantiated by the injector and injected into other registered dependencies and the main function.\n\n**signatures**\n\n*registerType(name, type, [lifetime = 'transient'], [provider]) : void*\n*registerType(name, type: [2-\\*], [lifetime = 'transient'], [provider]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *type (function|array): mandatory*.\n   - When type is a function, its dependencies are inferred from its parameter names.\n   - When type is an array, all items except the last are dependency names for the type, and the last is the actual type, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n- *lifetime (string): optional, default transient*. the type's lifetime, currently supported are *singleton* (only one instance of the type will exist throughout the applications lifecycle), *state* (one instance exists until the application's state changes), and *transient* (every time the type is referred, a new instance is created).\n- <a name=\"registration-type-provider\"></a>*provider (string): optional.* If present, `type` will be passed through the given provider before being injected. It is called `passive provider` because you don't need to actively inject it anywhere.\n\n> **Note:** for now, if you plan on using the default, `transient` lifetime and want to pass in a passive provider, you either need to explicitly specify `'transient'` or pass in `null` as your third parameter.\n\n**example**\n\n    injector.registerType('my-test-type', function () { \n        this.hello = 'world' \n    }, 'singleton'); // only one instance will ever be created.\n\n    injector.registerType('message-logger', function (message) { \n        this.print = function () { \n          console.log('hello, ' + message.hello) \n        }\n    }); will always create a new instance on injection\n\n### <a name=\"registration-provider\"></a>injector.registerProvider\n\nAllows you to register a provider which can be instantiated by the injector and injected into other registered dependencies and the main function. Currently the only difference between this function and registerType is providers are run directly, and aren't newed. in the future, they'll receive info on the context under which they're being executed, as well as any extra parameters passed when they're called.\n\n**signatures**\n\n*registerProvider(name, provider) : void*\n*registerProvider(name, provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *name (string): mandatory*. The name of the type being registered.\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type **MUST** be an array if you plan to minify your code\n\n\n\n### <a name=\"registration-main\"></a>injector.registerMain\n\nAllows you to register the provider that gets invoked when `injector.run()` is called. shorthand for `injector.registerProvider('main', [dependencies... function () {}]);`\n\n**signatures**\n\n*registerMain(provider) : void*\n*registerMain(provider: [2-\\*]) : void*\n\n**Parameters**\n\n- *provider (function|array): mandatory*.\n   - When provider is a function, its dependencies are inferred from its parameter names.\n   - When provider is an array, all items except the last are dependency names for the provider, and the last is the actual provider, which will receive all the aforementioned dependencies on instantiation.\n\n> **Note**: type MUST be an array if you plan to minify your code\n\n### <a name=\"registration-$inject\"></a> $inject property\n\nAs an alternative to array notation, you can specify your dependencies as an array in Type.$inject\n\n**example**\n\n    var type = function (dependency) { \n       this.hello = dependency\n    }\n    \n    type.$inject = ['dependency']\n    injector.registerType('my-test-type', type, 'singleton'); \n\n## <a name=\"injection\"></a>Injection Methods\n\n### <a name=\"injection-get\"></a>injector.get\n\ngets a registered type or provider. Not recommended for use other than to replace the new keyword while refactoring legacy code\n\n**signatures**\n*get(name, [context], [ad hoc dependencies]) : object*\n\n**parameters**\n\n- *name(string|array|function): mandatory.*\n\t- If string, the name of the type you want to get.\n\t- If function, the function you wish to get. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to get. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the invoked provider.\n- <a name=\"injection-get-adhoc\"></a>*ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n> **Note:** type **MUST** be an array if you plan to minify your code\n\n\n**example**\n\n    var logger = injector.get('message-logger');\n    logger.print(); // logs 'hello, world' to the console\n\n### <a name=\"injection-inject\"></a>injector.inject\n\ninjects all dependencies into the requested type and returns a provider for said type. Useful when instantiating the same object multiple times, for currying event callbacks, and for testing.\n\n**signatures**\n*inject(name) : object*\n\n**parameters**\n\n- name(string|array|function): mandatory.\n\t- If string, the name of the type you want to inject.\n\t- If function, the function you wish to inject. its dependencies are inferred from its parameter names.\n\t- If array, an array of dependencies followed by the function you wish to inject. If you supply a name or a function, it will be instantiated as a provider, calling it directly, without the new keyword.\n\n> **Note**: name **MUST** be an array if you are passing in an anonymous dependency and plan to minify your code\n\n\n**examples**\n\n    var logger_provider = injector.inject('message-logger'),\n        first_logger = logger_provider(),\n        second_logger = logger_provider(); // much faster to instantiate, since the provider has already been built and is ready to use\n        \n    first_logger.print(); // logs 'hello, world' to the console\n    second_logger.print(); // also logs 'hello, world' to the console\n    \n    $('#some-element').click(injector.inject(function (logger) {\n        // this code will be run when the event is called, and logger will be available to log anything that has something to do with the event\n        // for now, the event object won't be available, so its use is limited in this context. This functionality will be introduced in 0.2\n    }));\n\nJasmine test:\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n    \n    describe 'you can inject dependencies here and not worry about setup and teardown', () ->\n        beforeEach(injector.inject(function (logger) {\n            logger.log('starting test')\n        }));\n        \n        afterEach(injector.inject(function (logger) {\n            logger.log('ending test')\n        }));\n\n\n### <a name=\"injection-run\"></a>injector.run\n\nruns the main function.\n\n**signatures**\n\n*run([context], [ad hoc dependencies]) : void*\n\n**parameters**\n\n- *context (object): optional.* If a context is passed it will be used as the value of `this` on the `main` provider.\n- *ad hoc dependencies (object): optional.* An array of dependencies to be passed right before a provider is invoked. Useful for providers that require information specific to the environment where/when they are being invoked. Dependencies in the passed object supersede any dependencies defined via the register methods.\n\n> **Note:** `context` is only relevant if you're planning on invoking a provider. when instantiating a type, this parameter has no use (unless the type specifies a passive provider, in which case said provider will run using `context` as `this`).\n\n**throws error when no main function is registered**\n\n## <a name=\"utility\"></a>utility methods\n\n### <a name=\"utility-gettype\"></a>injector.getType\n\ngets the type of requested dependency. Useful for checking instanceof and testing constructors for singleton lifetime types (other uses should be avoided).\n\n**signature**\n\n*getType(name) : Type|null*\n\n**parameters**\n\n- *name (string): mandatory*. name of the dependency for which you wish to get the type.\n\n**returns**\n\nthe type or null if no type is found.\n\n### <a name=\"utility-removeDefaultListener\"></a>injector.removeDefaultListener\n\nDe-registers `hashchange` event for clearing state lifetime `types`.\n\n> **Note:** by default, InjectJS assumes your application is changing state (i.e. moving to another area of the application) every time the hash portion of the URL is changed. While this may be the default behaviour for most web sites, and is encouraged by most routers (like `Backbone`'s `routes`, `simrou`, `AngularJS ng-route`'s default behaviour), more and more sites are adopting HTML5 pushstate, and there are quite a few SPA's which don't use the hash at all. for those sites, you should call this method and then register a handler for your particular state change that calls `injector.clearState`\n\n**signature**\n\ninjector.removeDefaultListener()\n\n### <a name=\"utility-clearState\"></a>injector.clearState\n\nClears all `state` lifetime instantiated types.\n\n**signature**\n\ninjector.clearState()\n\n## <a name=\"testing\"></a>Test Helpers\n\nInjectJS currently provides some features to aid in unit testing (tested with jasmine only)\n\n### <a name=\"testing-fakes\"></a>injector.registerFake\n\nregisters a type as a fake.\n\n**signatures**\nsignatures are identical to [registerType](#registration-type)\n\n### <a name=\"testing-fakes-remove\"></a>injector.removeFake\n\nremoves a fake from the fakes collection.\n\n**signature**\n\n*injector.removeFake(name)*\n\n**parameters**\n\n- *name (string): mandatory*. name of the fake you want to remove.\n\n### <a name=\"testing-fakes-flush\"></a>injector.flushFakes\n\nremoves all fakes from the fakes collection. Identical to `injector.fakes = {}`\n\n**signature**\n\n*injector.flushFakes()*\n\n### <a name=\"testing-harness\"></a>injector.harness\n\nidentical to [inject](#injection-inject), but injects dependencies lazily (inject is eager)\n\n**example**\n\n    injector.registerType('logger', function () {\n        this.log = function (message) {\n            if (dump) {\n                dump(message);\n            } else {\n                console.log(message);\n            }\n        }\n    }, 'singleton');\n\n    describe('running tests with a harness', function () {\n        beforeAll(function () {\n            injector.registerFake('logger', function () {\n                this.log = sinon.spy();\n            });\n        });    \n        \n        afterAll(function () {\n            delete injector.fakes.logger;\n            \n        describe('using inject'), injector.inject(function (logger) {\n            it('passes the actual logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //fails because getType returns the fake\n            });\n        });\n        \n        describe('using harness'), injector.harness(function (logger) {\n            it('passes the fake logger type', function () {\n                expect(logger instanceof injector.getType('logger')).toBe true //passes because logger is the fake type\n            });\n        });\n    });\n","maintainers":[{"name":"nstraub","email":"spameggspambakedbeansandspam@gmail.com"}],"time":{"modified":"2022-06-19T01:18:52.990Z","created":"2016-03-16T23:04:13.980Z","0.3.0":"2016-03-16T23:04:13.980Z","0.3.1":"2016-03-17T00:48:14.256Z","0.3.2":"2016-03-17T01:27:29.595Z","0.3.3":"2016-03-23T01:48:13.439Z","0.3.4":"2016-03-24T01:30:57.072Z","0.4.0":"2016-03-30T08:38:04.154Z","0.4.1":"2016-04-07T00:52:39.146Z","0.4.3":"2016-04-07T02:29:50.047Z","0.4.4":"2016-04-07T05:12:06.416Z","0.4.5":"2016-04-07T06:31:11.463Z","0.4.6":"2016-04-07T07:42:39.092Z","0.4.7":"2016-04-07T09:26:46.732Z","0.4.8":"2016-04-07T09:39:05.095Z","0.4.9":"2016-04-07T13:57:26.365Z","0.4.10":"2016-04-08T01:07:06.829Z","0.4.11":"2016-04-08T01:16:36.864Z","0.4.12":"2016-04-08T10:09:13.102Z","0.4.13":"2016-04-20T08:27:20.939Z","0.4.14":"2016-04-25T07:23:52.501Z","0.4.15":"2016-04-26T12:35:48.335Z","0.5.2":"2018-02-15T06:07:50.102Z","0.5.3":"2018-02-15T06:40:56.830Z","0.5.4":"2018-02-15T06:43:31.077Z","0.5.6":"2018-02-22T18:39:08.571Z","0.5.7":"2019-02-15T22:36:26.292Z"},"homepage":"https://github.com/nstraub/injectjs","keywords":["dependency","injector","lightweight","inject","lifetime","singleton","transient","parent"],"repository":{"type":"git","url":"git+https://github.com/nstraub/injectjs.git"},"author":{"name":"Nicolas Straub"},"bugs":{"url":"https://github.com/nstraub/injectjs/issues"},"license":"ISC","readmeFilename":"README.md"}