Breaking Changes
- Removed
transformoption
Enhancements
- Adds support for mixing strings, arrays, functions, and objects in an array
const constants = require('namespace-constants');
export const {
ADD_TODO,
REMOVE_TODO,
TOGGLE_TODO,
SHOW_ALL,
SHOW_COMPLETED,
SHOW_ACTIVE,
FETCH,
EXPORT,
} = constants('ns', [
'ADD_TODO',
'REMOVE_TODO',
'TOGGLE_TODO',
// an array of strings
['SHOW_ALL', 'SHOW_COMPLETED', 'SHOW_ACTIVE'],
// a function returning an array of strings
() => (['SHOW_ALL', 'SHOW_COMPLETED', 'SHOW_ACTIVE']),
{ // Sugar syntax for declaring async constants
FETCH: ['REQUEST', 'SUCCESS', 'FAILURE'],
EXPORT: 'REQUEST'
}
]);will give you the following output:
