{"id":13661117,"url":"https://github.com/unlight/inject","last_synced_at":"2025-04-10T22:31:42.582Z","repository":{"id":57111759,"uuid":"84199111","full_name":"unlight/inject","owner":"unlight","description":"Inject a dependency (service locator pattern)","archived":false,"fork":false,"pushed_at":"2024-02-07T05:51:13.000Z","size":245,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-05T11:34:56.042Z","etag":null,"topics":["dependency-injection","inject","injector","service-locator"],"latest_commit_sha":null,"homepage":"","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/unlight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-03-07T12:56:53.000Z","updated_at":"2023-03-04T05:38:48.000Z","dependencies_parsed_at":"2024-03-31T15:51:46.154Z","dependency_job_id":null,"html_url":"https://github.com/unlight/inject","commit_stats":{"total_commits":49,"total_committers":6,"mean_commits":8.166666666666666,"dds":0.6326530612244898,"last_synced_commit":"e1b0253df5d30ef1fa8fb7829265df84b0b3afb5"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Finject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Finject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Finject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Finject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlight","download_url":"https://codeload.github.com/unlight/inject/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223449848,"owners_count":17146984,"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-injection","inject","injector","service-locator"],"created_at":"2024-08-02T05:01:29.990Z","updated_at":"2024-11-07T03:06:59.088Z","avatar_url":"https://github.com/unlight.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# inject\n\nInject a dependency (service locator pattern).\n\n## USAGE\n\n```ts\n// app.ts\nimport { inject } from 'njct';\nconst fs = inject('fs', () =\u003e require('fs'));\nfs.readFileSync('data.json');\n\n// app.spec.ts\nimport { injector } from 'njct';\ninjector.provide('fs', () =\u003e ({\n  readFileSync: () =\u003e 'result of call of fs.readFileSync()',\n}));\n```\n\n```ts\nclass Car {\n  static count = 0;\n  constructor() {\n    Car.count++;\n  }\n}\nlet vehicle = inject(Car);\nvehicle = inject(Car);\nexpect(vehicle).toBeA(Car);\nexpect(Car.count).toEqual(1);\n```\n\n## Similar Projects\n\n- https://github.com/mickgrz/injects\n\n## License\n\n[MIT License](https://opensource.org/licenses/MIT) (c) 2022\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Finject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlight%2Finject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Finject/lists"}