From 023c719dfaa7d2e349d9b9890bff8a665839158d Mon Sep 17 00:00:00 2001 From: Heath Morrison Date: Tue, 15 Sep 2015 01:22:18 +0300 Subject: [PATCH] Fixed promise detection and removed repl.history completely --- package.json | 12 +++++------- repl.js | 8 +------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 7d1fed1..ea223ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-console", - "version": "0.1.0", + "version": "0.1.1", "description": "A REPL for Loopback app administration and convenience", "main": "index.js", "license": "MIT", @@ -16,14 +16,12 @@ "email": "heath@govright.org" } ], - "bin" : { - "loopback-console" : "./bin/loopback-console" + "bin": { + "loopback-console": "./bin/loopback-console" }, "dependencies": { "app-root-path": "^1.0.0", - "lodash": "^3.1.0", - "repl.history": "^0.1.3" + "lodash": "^3.1.0" }, - "devDependencies": { - } + "devDependencies": {} } diff --git a/repl.js b/repl.js index 4abf1b7..9e68b18 100644 --- a/repl.js +++ b/repl.js @@ -2,7 +2,6 @@ var vm = require('vm'); var util = require('util'); var repl = require('repl'); -var replHistory = require('repl.history'); var _ = require('lodash'); module.exports = { @@ -12,10 +11,6 @@ module.exports = { var replServer = repl.start(config); - if (ctx.config.history) { - replHistory(replServer, config.history); - } - replServer.on('exit', process.exit); _.extend(replServer.context, handles); @@ -55,8 +50,7 @@ function loopbackAwareEval(code, context, file, cb) { if (!err) { try { result = script.runInThisContext({ displayErrors: false }); - // FIXME: Better promise detection - if (result && String(result.constructor) === 'function Promise() { [native code] }') { + if (typeof Promise !== 'undefined' && result instanceof Promise) { result.then(function (r) { _.each(context, function (v, k) { if (context[k] === result) {