Rename TSInjex to TSinjex and Add Jest Setup in README

Renamed all instances of 'TSInjex' to 'TSinjex' for consistency across the codebase, including interfaces, classes, and test files. Updated the version in `package.json` from 0.0.5 to 0.0.6. Added Jest setup example to the `README.md` to guide developers on initial configuration for testing.
This commit is contained in:
2024-08-14 23:10:44 +02:00
parent ad4a8fd8c6
commit 771b810419
13 changed files with 222 additions and 200 deletions

View File

@@ -1,4 +1,4 @@
import { TSInjex } from '../TSInjex';
import { TSinjex } from '../TSinjex';
import { InitDelegate } from '../types/InitDelegate';
/**
@@ -12,7 +12,7 @@ import { InitDelegate } from '../types/InitDelegate';
* - If `true`, an error will be thrown if the dependency cannot be resolved.
* - If `false`, `undefined` will be returned if the dependency cannot be resolved.
* @returns A decorator function to be applied on the class property.
* @see {@link TSInjex}
* @see {@link TSinjex}
* @example
* ```ts
* class MyClass {
@@ -37,7 +37,7 @@ export function Inject<T, U>(
// Unique symbol to store the private property
const privatePropertyKey: unique symbol = Symbol();
// Get the DI container instance
const diContainer = TSInjex.getInstance();
const diContainer = TSinjex.getInstance();
// Function to evaluate the dependency lazily
// to avoid circular dependencies, not found dependencies, etc.

View File

@@ -1,4 +1,4 @@
import { TSInjex } from '../TSInjex';
import { TSinjex } from '../TSinjex';
/**
* A decorator to register a class in the DI (Dependency Injection) container.
@@ -20,7 +20,7 @@ export function Register<
>(identifier: string, deprecated?: boolean) {
return function (constructor: TargetType, ...args: unknown[]): void {
// Get the instance of the DI container
const diContainer = TSInjex.getInstance();
const diContainer = TSinjex.getInstance();
// Register the class in the DI container
diContainer.register(identifier, constructor, deprecated);

View File

@@ -1,4 +1,4 @@
import { TSInjex } from '../TSInjex';
import { TSinjex } from '../TSinjex';
import { InitDelegate } from '../types/InitDelegate';
/**
@@ -28,7 +28,7 @@ export function RegisterInstance<
) {
return function (constructor: TargetType, ...args: unknown[]): void {
// Get the instance of the DI container
const diContainer = TSInjex.getInstance();
const diContainer = TSinjex.getInstance();
// Create a proxy to instantiate the class when needed (Lazy Initialization)
let lazyProxy: unknown = new Proxy(