is-recoverable-error
isRecoverableError from Node.js' REPL
Last updated 3 years ago by addaleax .
MIT · Bugs · Original npm · Tarball · package.json
$ cnpm install is-recoverable-error 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.3                                ...           latest (3 years ago)

4 Versions

  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |