Socket
Book a DemoInstallSign in
Socket

bs-node-readline

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-node-readline

Node readline bindings for BuckleScript

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
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

bucklescript

FAQs

Package last updated on 08 Feb 2020

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.