Comparing version 3.0.0 to 3.0.1
'use strict'; | ||
const Wit = require('node-wit').Wit; | ||
// Joke example | ||
// See https://wit.ai/patapizza/example-joke | ||
const Wit = require('../').Wit; | ||
const token = (() => { | ||
@@ -6,0 +9,0 @@ if (process.argv.length !== 3) { |
@@ -44,3 +44,3 @@ 'use strict'; | ||
if (!actions.say) { | ||
throw new Error('The \'say\' action is missing. '); | ||
throw new Error('The \'say\' action is missing. ' + learnMore); | ||
} | ||
@@ -50,2 +50,5 @@ if (!actions.merge) { | ||
} | ||
if (!actions.error) { | ||
throw new Error('The \'error\' action is missing. ' + learnMore); | ||
} | ||
Object.keys(actions).forEach(key => { | ||
@@ -59,2 +62,4 @@ if (typeof actions[key] !== 'function') { | ||
throw new Error('The \'merge\' action should accept 3 arguments: context, entities, callback. ' + learnMore); | ||
} else if (key === 'error' && actions.error.length !== 2) { | ||
throw new Error('The \'error\' action should accept 2 arguments: sessionId, callback. ' + learnMore); | ||
} else if (key !== 'say' && key !== 'merge' && actions[key].length !== 2) { | ||
@@ -228,4 +233,10 @@ throw new Error('The \'' + key + '\' action should accept 2 arguments: context, callback. ' + learnMore); | ||
} else { // error | ||
if (!this.actions.error) { | ||
if (cb) { | ||
cb('No \'error\' action found.'); | ||
} | ||
return; | ||
} | ||
l.log('Executing error action'); | ||
this.actions.error(sessionId, 'No action available.'); | ||
this.actions.error(sessionId, 'No \'error\' action found.'); | ||
return; | ||
@@ -232,0 +243,0 @@ } |
{ | ||
"name": "node-wit", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Wit.ai Node.js SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -15,3 +15,5 @@ # Wit Node.js SDK | ||
```nodejs | ||
Create `index.js`, containing: | ||
```js | ||
'use strict'; | ||
@@ -41,2 +43,8 @@ const Wit = require('node-wit').Wit; | ||
Then run in your terminal: | ||
```bash | ||
node index.js | ||
``` | ||
See `examples` folder for more examples. | ||
@@ -43,0 +51,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
15072
10
438
59
0