Socket
Socket
Sign inDemoInstall

node-wit

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-wit - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

.npmignore

5

examples/joke.js
'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) {

15

lib/wit.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc