How to use the readline-sync.questionFloat function in readline-sync

To help you get started, we’ve selected a few readline-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ftchirou / blink / src / main / interpreter / std / console.js View on Github external
new NativeExpression((context) => {
                process.stdin.pause();

                let input = readline.questionFloat('');

                console.log();

                let value = Obj.create(context, Types.Double);

                value.set('value', input);

                process.stdin.resume();

                return value;
            })));
    }
github PolymathNetwork / polymath-core / CLI / commands / token_manager.js View on Github external
break;
    case 'Mint tokens':
      await mintTokens();
      break;
    case 'Manage modules':
      await listModuleOptions();
      break;
    case 'Withdraw tokens from contract':
      let tokenAddress = readlineSync.question(`Enter the ERC20 token address (POLY ${polyToken.options.address}): `, {
        limit: function (input) {
          return web3.utils.isAddress(input);
        },
        limitMessage: "Must be a valid address",
        defaultInput: polyToken.options.address
      });
      let value = readlineSync.questionFloat('Enter the value to withdraw: ', {
        limit: function (input) {
          return input > 0;
        },
        limitMessage: "Must be a greater than 0"
      });
      await withdrawFromContract(tokenAddress, web3.utils.toWei(new web3.utils.BN(value)));
      break;
    case 'Exit':
      process.exit();
      break;
  }
}
github ftchirou / blink / src / main / interpreter / std / console.js View on Github external
new NativeExpression((context) => {
                process.stdin.pause();

                let prompt = context.store.get(context.environment.find('prompt'));

                let input = readline.questionFloat(prompt.get('value'));

                console.log();

                let value = Obj.create(context, Types.Double);

                value.set('value', input);

                process.stdin.resume();

                return value;
            })));