A customizable status mapper
npm install @janiscommerce/status-mapper
const StatusMapper = require('@janiscommerce/status-mapper');
const statusMapper = new StatusMapper();
// Status
statusMapper.map('active'); // return 1
statusMapper.map(1); // return 'active'
statusMapper.set('example', 20);
statusMapper.map('example'); // return 20
statusMapper.replace({ example: 30 }); // replace all statuses
statusMapper.map('example'); // return 30
// Colors
statusMapper.mapToColor('active'); // return 'green'
statusMapper.mapToColor(1); // return 'green'
statusMapper.setColor('example', 'black');
statusMapper.mapToColor('example'); // return 'black'
statusMapper.replaceColor({ example: 'white' }); // replace all status colors
statusMapper.mapToColor('example'); // return 'white'