Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

promirepl

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

promirepl

Promise infused REPL

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2K
decreased by-8.79%
Maintainers
1
Weekly downloads
 
Created
Source

promirepl

A promise infused REPL.

Promirepl provides a Node.js REPL which will automagically unwrap promise values. It also is Node module, with a function that can add these magical promise inspecting capabilities to your own custom REPLs.

This allows you to use promise based APIs from the REPL just as easily as old fashioned synchronous APIs, without a lot of messing around with callbacks and console.log to get at asynchronous values from the REPL.

Installation

Promirepl can be installed with npm install -g promirepl. This installs the prominode executable, which starts a Node.js REPL that has magical promise unwraping capabilities.

Usage

$ prominode

Whenever a value evaluates to a promise (well, technically a thenable), promirepl will wait for the promise to resolve.

> Promise.resolve('hello')
'hello'

> new Promise((resolve) => {
... setTimeout(() => { resolve('some time later'); }, 3000);
... })
'some time later'

If the promise is rejected, it will evaluate as a thrown error.

> Promise.reject(new Error('boom'))
Error: boom
    at repl:1:16
    at REPLServer.defaultEval (repl.js:135:27)

If you would like to stop waiting on a promise, hit escape.

> new Promise(function () {})
Hit escape to stop waiting on promise
break.

If you would like to disable promise unwrapping, enter the .promise command.

> .promise
Promise auto-eval disabled

> Promise.resolve('hello')
{}

> Promise.reject(new Error('boom'))
{}

Programmatic Usage

If you would like to use promirepl within your own custom REPL, use the exported promirepl function.

const customRepl = createCustomRepl();
const { promirepl } = require('promirepl');
promirepl(customRepl.start({}));

Keywords

FAQs

Package last updated on 02 Mar 2019

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc