is-recoverable-error
isRecoverableError from Node.js' REPL
Last updated 3 months ago by lrlna .
Apache-2.0 · 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

Apache-2.0

Current Tags

  • 1.0.2                                ...           latest (3 months ago)

3 Versions

  • 1.0.2                                ...           3 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 3
Last Month 7
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |