### File

`src/lib/config-testing-service.ts`

### Index

###### Properties
Readonly config
###### Methods
clearLocalConfig get getOrThrow set setLocalConfig

### Methods

clearLocalConfig
`clearLocalConfig()`
Defined in src/lib/config-testing-service.ts:13
Returns : `void`

get
`get(propertyPath: string, defaultValue?: T)`
Defined in src/lib/config-testing-service.ts:20
Type parameters : T
Parameters :
Name | Type | Optional
propertyPath | `string` | No
defaultValue | `T` | Yes
Returns : `T | undefined`

getOrThrow
`getOrThrow(propertyPath: string)`
Defined in src/lib/config-testing-service.ts:24
Type parameters : T
Parameters :
Name | Type | Optional
propertyPath | `string` | No
Returns : `T`

set
`set(propertyPath: string, value: T)`
Defined in src/lib/config-testing-service.ts:16
Type parameters : T
Parameters :
Name | Type | Optional
propertyPath | `string` | No
value | `T` | No
Returns : `void`

setLocalConfig
`setLocalConfig(config: Record)`
Defined in src/lib/config-testing-service.ts:33
Parameters :
Name | Type | Optional
config | `Record<string | any>` | No
Returns : `void`

### Properties

Readonly config
Type : `Record<string | any>`
Default value : `{}`
Defined in src/lib/config-testing-service.ts:10

    import { Injectable } from '@angular/core';
    import {
      getFromObject,
      SetToObject,
    } from '@rxap/utilities';
    import { ConfigService } from './config.service';

    @Injectable()
    export class ConfigTestingService implements ConfigService {
      readonly config: Record<string, any> = {};

      // eslint-disable-next-line @typescript-eslint/no-empty-function
      clearLocalConfig(): void {
      }

      set<T>(propertyPath: string, value: T): void {
        SetToObject(this.config, propertyPath, value);
      }

      get<T>(propertyPath: string, defaultValue?: T): T | undefined {
        return getFromObject<T, T>(this.config, propertyPath, defaultValue);
      }

      getOrThrow<T>(propertyPath: string): T {
        const value = this.get<T>(propertyPath);
        if (value === undefined) {
          throw new Error(`Could not find config in path '${ propertyPath }'`);
        }
        return value;
      }

      // eslint-disable-next-line @typescript-eslint/no-empty-function
      setLocalConfig(config: Record<string, any>): void {
      }
    }

# results matching ""

# No results matching ""