Skip to content

Commit

Permalink
Fixed promise detection and removed repl.history completely
Browse files Browse the repository at this point in the history
  • Loading branch information
Heath Morrison committed Sep 14, 2015
1 parent 591bb72 commit 023c719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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": {}
}
8 changes: 1 addition & 7 deletions repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 023c719

Please sign in to comment.