Skip to content

Commit

Permalink
refactor(ccc/utils/chat): add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaa committed Nov 15, 2024
1 parent 7571e2a commit e36f2cf
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions packages/ccc/src/utils/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,28 @@ const prefixAndSuffix = (prefixAndSuffix: string) =>
: str
}${prefixAndSuffix}`

/**
* Generate action string.
*
* @example
* ```ts
* const foo = action`Hello, World` // `*Hello, World*`
* const bar = action('What is love?') // '*What is love?*'
* const baz = action(['lorem,', 'ipsum']) // '*lorem, ipsum*'
* ```
*/
export const action = prefixAndSuffix('*')

/**
* Generate message string.
*
* @example
* ```ts
* const foo = message`Hello, World` // `"Hello, World"`
* const bar = message('What is love?') // '"What is love?"'
* const baz = message(['lorem,', 'ipsum']) // '"lorem, ipsum"'
* ```
*/
export const message = prefixAndSuffix('"')

export { action as act }
export { message as msg }
export { action as act, message as msg }

0 comments on commit e36f2cf

Please sign in to comment.