{"id":24388099,"url":"https://github.com/imoverlord/sloth-ts-injection","last_synced_at":"2026-04-29T09:02:16.984Z","repository":{"id":57363325,"uuid":"167256311","full_name":"ImOverlord/sloth-ts-injection","owner":"ImOverlord","description":"Sloth Dependency Injection For Typescript","archived":false,"fork":false,"pushed_at":"2023-01-04T21:36:33.000Z","size":245,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T05:20:31.549Z","etag":null,"topics":["dependency","dependency-injection","injection","sloth","sloth-dependency-injection","tool","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ImOverlord.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-23T21:23:25.000Z","updated_at":"2019-02-06T13:25:11.000Z","dependencies_parsed_at":"2023-02-02T20:45:39.394Z","dependency_job_id":null,"html_url":"https://github.com/ImOverlord/sloth-ts-injection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ImOverlord/sloth-ts-injection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImOverlord%2Fsloth-ts-injection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImOverlord%2Fsloth-ts-injection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImOverlord%2Fsloth-ts-injection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImOverlord%2Fsloth-ts-injection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ImOverlord","download_url":"https://codeload.github.com/ImOverlord/sloth-ts-injection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImOverlord%2Fsloth-ts-injection/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261795335,"owners_count":23210620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency","dependency-injection","injection","sloth","sloth-dependency-injection","tool","typescript"],"created_at":"2025-01-19T13:56:19.022Z","updated_at":"2026-04-29T09:02:11.912Z","avatar_url":"https://github.com/ImOverlord.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sloth-ts-injection\n\n[![Build Status](https://travis-ci.org/ImOverlord/sloth-ts-injection.svg?branch=master)](https://travis-ci.org/ImOverlord/sloth-ts-injection)\n[![Coverage Status](https://coveralls.io/repos/github/ImOverlord/sloth-ts-injection/badge.svg?branch=master)](https://coveralls.io/github/ImOverlord/sloth-ts-injection?branch=master)\n\n\nSloth Dependency Injection For Typescript\n\n## Installation\n\nYou can get the latest release and the type definitions using npm:\n\n```\n$ npm install sloth-ts-injection reflect-metadata --save\n```\n\n\u003e /!\\\\ sloth-ts-injection requires TypeScript \u003e= 2.0, your tsconfig should look similar to the one below (experimentalDecorators, emitDecoratorMetadata are important)\n```js\n{\n    \"compilerOptions\": {\n        \"target\": \"es5\",\n        \"lib\": [\"es6\"],\n        \"types\": [\"reflect-metadata\"],\n        \"module\": \"commonjs\",\n        \"moduleResolution\": \"node\",\n        \"experimentalDecorators\": true,\n        \"emitDecoratorMetadata\": true\n    }\n}\n```\n\n## Getting Started\n\nYou can declare dependencies with @slothInject() decorator.\n\n```ts\nimport { slothInject } from 'sloth-ts-injection';\n\n@slothInject()\nexport class DependencyA {\n    public data: number = 0;\n}\n```\n\nYou can then require this dependency.\n\n```ts\nimport { slothInject } from 'sloth-ts-injection';\nimport { DependencyA } from \"./dependencyA\";\n\n@slothInject()\nexport class DependencyD {\n\n    constructor(public a: DependencyA   ) { }\n\n    public update() {\n        this.a.data++;\n    }\n}\n```\n\nsloth-ts-injection will resolve the dependencies needed for you\n\n```ts\nimport { Injector } from 'sloth-ts-injection';\n\nconst injector = new Injector();\nconst dep: DependencyD = injector.inject(DependencyD);\n\ndep.update();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimoverlord%2Fsloth-ts-injection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimoverlord%2Fsloth-ts-injection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimoverlord%2Fsloth-ts-injection/lists"}