Socket
Socket
Sign inDemoInstall

bs-node-readline

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bs-node-readline

Node readline bindings for BuckleScript


Version published
Maintainers
1
Install size
61.8 kB
Created

Readme

Source

bs-node-readline

Low level bindings for Node's readline

Example

let options =
  Readline.interfaceOptions(
    ~input=[%raw "process.stdin"],
    ~output=[%raw "process.stdout"],
    (),
  );

let readline = Readline.createInterface(options);
let yes = [%re "/yes|y/gi"];
let no = [%re "/no|n/gi"];

readline
|. Readline.question("Is ReasonML and BuckleScript awesome? ", answer => {
     switch (answer) {
     | a when Js.Re.test(a, yes) => print_endline("You know it!")
     | a when Js.Re.test(a, no) =>
       print_endline("You need to revaluate your answer")
     | a =>
       print_endline({j| I don't have a variant for your answer 😦: $a |j})
     };
     Readline.close(readline);
   });

then you can run the compiled JS file with Node: Example of binding

Installation

npm i --save bs-node-readline

then add Then add bs-node-readline to bs-dependencies in your bsconfig.json:

{
  ...
  "bs-dependencies": ["bs-node-readline"]
}

Usage

See example in example/example.re. Follows the NodeJS API found here: https://nodejs.org/api/readline.html

Keywords

FAQs

Last updated on 08 Feb 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc