@elizaos/core v0.1.7-alpha.1 / composeRandomUser
composeRandomUser(
template
,length
):string
Generates a string with random user names populated in a template.
This function generates a specified number of random user names and populates placeholders
in the provided template with these names. Placeholders in the template should follow the format {{userX}}
where X
is the position of the user (e.g., {{user1}}
, {{user2}}
).
• template: string
• length: number
string
The template string with placeholders replaced by random user names.
// Given a template and a length
const template = "Hello, {{user1}}! Meet {{user2}} and {{user3}}.";
const length = 3;
// Composing the random user string will result in:
// "Hello, John! Meet Alice and Bob."
const result = composeRandomUser({ template, length });