5.7.1 Java  Script
5.7.1.1 Types
5.7.1.2 loader.mjs
5.7.1.3 Accounts
5.7.1.4 Contracts
5.7.1.5 Network Utilities
5.7.1.6 Provider Selection
5.7.1.7 Utilities
5.7.1.8 ask.mjs
On this page:
ask
yesno
done
5.7.1.8 ask.mjs

The Reach JavaScript standard library also provides the helper module @reach-sh/stdlib/ask.mjs for constructing console interfaces to your frontends.

import * as ask from '@reach-sh/stdlib/ask.mjs';

It provides the following exports:

ask(string, (string => result)) => Promise<result>
yesno(string) => boolean
done() => null

ask is an asynchronous function that asks a question on the console and returns a Promise for the first result that its second argument does not error on.

yesno is an argument appropriate to give as the second argument to ask that parses "Yes"/"No" answers.

done indicates that no more questions will be asked.