Skip to content

Releases: cheton/namespace-constants

v1.0.0

29 May 08:17
4eab324

Choose a tag to compare

Breaking Changes

  • Removed transform option

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:

image

v0.5.0

27 Dec 16:25

Choose a tag to compare

PR #1: Added ability to transform constants name (7c362d3, added by @mgoffan)

v0.1.1

15 Jun 14:32

Choose a tag to compare

Add the "files" field to include only necessary files

v0.1.0

31 May 03:59

Choose a tag to compare

Initial release