feat(Flash): Normalize flash types with object

help prevent typo errors
This commit is contained in:
Berkeley Martinez
2018-01-29 11:34:44 -08:00
parent ae3ccdd672
commit 1ee9d9259c
4 changed files with 17 additions and 15 deletions

10
common/utils/flash.js Normal file
View File

@@ -0,0 +1,10 @@
import _ from 'lodash';
export const alertTypes = _.keyBy([
'success',
'info',
'warning',
'danger'
], _.identity);
export const normalizeAlertType = alertType => alertTypes[alertType] || 'info';