Socket
Socket
Sign inDemoInstall

is-recoverable-error

Package Overview
Dependencies
6
Maintainers
9
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-recoverable-error

isRecoverableError from Node.js' REPL


Version published
Weekly downloads
16K
decreased by-50.48%
Maintainers
9
Install size
657 kB
Created
Weekly downloads
 

Readme

Source

is-recoverable-error

isRecoverableError function from Node.js REPL

Usage

var isRecoverableError = require('is-recoverable-error')
var repl = require('repl')
var vm = require('vm')

function myEval (input, context, filename, callback) {
  var result
  try {
    result = vm.runInThisContext(input)
  } catch (e) {
    if (isRecoverableError(input)) {
      return callback(new repl.Recoverable(e))
    }
  }
  callback(null, result)
}

API

isRecoverableError(input)

Where input is a string. Returns a boolean.

isRecoverableError('function x () {') // returns true
isRecoverableErorr('<cat>') // returns false

Installation

npm install -S is-recoverable-error

License

MIT

FAQs

Last updated on 02 Dec 2022

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