Placeholders

usePlaceholders is a utility hook that provides common placeholder values used in Nexo Maker modules. It allows developers to access information about the current project, user, and timestamps without manually retrieving them each time.


Returned Values

Calling usePlaceholders() returns an object with the following properties:

Property
Type
Description

projectId

string

The current project ID. Defaults to 'unknown' if not available.

projectName

string

The current project name. Defaults to 'unknown'. Can be extended with real project data.

timestamp

function

Returns the current date and time in ISO format. Example: 2025-09-08T12:34:56.789Z.

userId

string

Identifier for the current user. Defaults to 'current-user'. Can be extended with real user info.


Usage Example

module.exports = ({ usePlaceholders, api }) => {
  const placeholders = usePlaceholders();

  api.console.log("Project ID:", placeholders.projectId);
  api.console.log("Project Name:", placeholders.projectName);
  api.console.log("Current Timestamp:", placeholders.timestamp());
  api.console.log("User ID:", placeholders.userId);
};

Notes

  • usePlaceholders is primarily used for dynamic file creation, logging, and metadata.

  • You can extend it to include more contextual information about the user or project as needed.

Last updated