inversify-string-mapper
v1.0.1
Published
string mapper definitions
Downloads
5
Readme
inversify-string-mapper
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'
...