inversify-string-mapper
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

inversify-string-mapper

version license build tests coverage

inversify string mapper utility

install dependencies

npm install

build

npm run build

test

npm test

test with coverage report

npm run test:coverage

mutation test

npm run test:mutation

format

npm run format

Install into project

npm install inversify-string-mapper

How to use

Load the module.

...
import { StringMapperModule } from "inversify-string-mapper";
...

export const container = (): Container => {
  const container = new Container();
  container.load(new StringMapperModule());
  return container;
};

Inject the interface by type.

...
import { STRING_MAPPER_TYPE, StringMapperInterface } from "inversify-string-mapper";
...

  @inject(STRING_MAPPER_TYPE.StringMapper)
  private readonly stringMapper: StringMapperInterface

Use the mapper.

...
  stringMapper.mapper('value'); // return 'value'
  stringMapper.mapper(null); // return ''
  stringMapper.mapper(null, 'default'); // return 'default'
  stringMapper.mapper(' value '); // return 'value'
  stringMapper.mapper(5); // return '5'
...

Readme

Keywords

none

Package Sidebar

Install

npm i inversify-string-mapper

Weekly Downloads

1

Version

1.0.1

License

GPL-3.0

Unpacked Size

77.9 kB

Total Files

19

Last publish

Collaborators

  • yadickson