📝Prop String

The module to handle the property in object by string.

Imports

import { PropStringService } from 'niro-health';

Method of Use

To use this module, you need to inject it into the desired service.

import { Module } from '@nestjs/common';
import {
  PropStringService,
} from 'niro-health';
import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: 'IPropStringService',
      useClass: PropStringService,
    },
  ],
})
export class AppModule {}

Injecting the module into our service.

import { Inject, Injectable } from '@nestjs/common';
import type { IPropStringService } from 'niro-health';

@Injectable()
export class AppService {
  constructor(
    @Inject('IPropStringService')
    private readonly propStringService: IPropStringService,
  ) {}

  public hello() {
    return this.propStringService.execute('text.hello', {
      text: { hello: 'Hello World' },
    });
  }
}

Without dependencies

You won't need to connect the pieces with any other module.

Methods

Method
Scope
Description

execute

public

Get value of property in object by string.

Last updated