Comparing version 3.2.1 to 3.2.2
@@ -1,4 +0,6 @@ | ||
## v3.2.1 | ||
## v3.2.2 | ||
- fixed context not updated in interactive sessions | ||
- fixing context not updated in interactive mode | ||
- fixing array values in context | ||
- create readline interface only in interactive mode | ||
@@ -5,0 +7,0 @@ ## v3.2.0 |
@@ -5,6 +5,2 @@ 'use strict'; | ||
const readline = require('readline'); | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
const uuid = require('node-uuid'); | ||
@@ -93,7 +89,15 @@ const Logger = require('./logger').Logger; | ||
const clone = (obj) => { | ||
const newObj = {}; | ||
Object.keys(obj).forEach(k => { | ||
newObj[k] = typeof obj[k] === 'object' ? clone(obj[k]) : obj[k]; | ||
}); | ||
return newObj; | ||
if (typeof obj === 'object') { | ||
if (Array.isArray(obj)) { | ||
return obj.map(clone); | ||
} else { | ||
const newObj = {}; | ||
Object.keys(obj).forEach(k => { | ||
newObj[k] = clone(obj[k]); | ||
}); | ||
return newObj; | ||
} | ||
} else { | ||
return obj; | ||
} | ||
}; | ||
@@ -262,5 +266,10 @@ | ||
const steps = maxSteps ? maxSteps : DEFAULT_MAX_STEPS; | ||
rl.setPrompt('> '); | ||
rl.prompt(); | ||
rl.on('line', ((line) => { | ||
this.rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
this.rl.setPrompt('> '); | ||
this.rl.prompt(); | ||
this.rl.write(null, {ctrl: true, name: 'e'}); | ||
this.rl.on('line', ((line) => { | ||
const msg = line.trim(); | ||
@@ -277,3 +286,4 @@ this.runActions( | ||
} | ||
rl.prompt(); | ||
this.rl.prompt(); | ||
this.rl.write(null, {ctrl: true, name: 'e'}); | ||
}, | ||
@@ -280,0 +290,0 @@ steps |
{ | ||
"name": "node-wit", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "Wit.ai Node.js SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28101
659