Skip to content

Commit

Permalink
fix: match Deno version of prompt (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter authored Dec 18, 2023
1 parent 4bdb332 commit b8705b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/shim-prompts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export const prompt: typeof globalThis extends { prompt: infer T } ? T
: (message?: string, _default?: string) => string | null =
(globalThis as any)["prompt"] ??
function prompt(
message,
defaultValue = undefined,
message = "Prompt",
defaultValue,
) {
writeSync(
process.stdout.fd,
new TextEncoder().encode(
`${message} ${defaultValue == null ? "" : `[${defaultValue}]`} `,
`${message}${defaultValue ? ` [${defaultValue}]` : ""} `,
),
);
const result = readlineSync();
Expand Down

0 comments on commit b8705b5

Please sign in to comment.