Skip to content

Function based code cannot be separated into logical groups #1

Open
@skurger

Description

@skurger

Thanks for the invite and excited to see where this goes! Reposting from the previous forked repo of esdoc.

I use Redux to manage the state of my applications. There are actions associated with any state change and reducers that process those actions. Let's say that some UI component has 5 actions associated with it and one reducer file that may also contain 1 or more functions. As my library of actions and reducers grows the documentation keeps growing as well.

Esdoc currently dumps anything that isn't a class into one main page under the "esdoc/function" URL. A way to group functions in a file under a unique URL per group would go a long way in organizing code. This would make it very easy to browse the API available to a developer while only focusing on one set of functionality.

Example: A group of actions that manipulate the state of modal dialogs.

actions/modal.js


/**
 * @module modal-actions
 */

/**
 * Modal action object
 * @typedef {Object} ModalAction
 * @property {number} id Unique ID of the modal
 * @property {string} type The action type
 */


/**
 * Close a modal
 * @param  {String} modalId Closes a modal
 * @return {ModalAction}
 */
export function closeModal(modalId = '') {
	return {
		id: modalId,
		type: CLOSE_MODAL
	};
}

/**
 * Open a modal
 * @param  {String} modalId Opens a modal
 * @return {ModalAction}
 */
export function openModal(modalId = '') {
	return {
		id: modalId,
		type: OPEN_MODAL
	};
}

The 2 functions above would be grouped under a single page. I'm using the @module tag from jsdoc that provides the kind of grouping functionality I'm looking for.

Let me know if further explanation is needed and willing to test the changes if / when implemented.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions