Socket
Socket
Sign inDemoInstall

sayhi-ai

Package Overview
Dependencies
70
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

30

index.js

@@ -14,2 +14,7 @@ var request = require('request-json');

function rand(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}
module.exports = {

@@ -25,2 +30,6 @@ init: function (email, password, callback) {

},
initWithToken: function(_token, callback) {
token = _token;
loadData(callback);
},
getData: function() {

@@ -34,8 +43,25 @@ return data;

};
client.post("/addphrase", posting, function(error, res, body) {
client.post("/addphrase", posting, function (error, res, body) {
data = body;
callback(data);
});
},
say: function(phrase, persona) {
var _phrase = data.phrases.find(function(item) {return item.name == phrase});
if (!_phrase) {
throw "Phrase doesn't exist. Add it by calling addResponse()";
}
var _persona = data.personas.find(function(item) {return item.name == persona});
if (!_persona) {
throw "Persona doesn't exist! Add it by calling addResponse()";
}
var responses = data.responses.filter(function(item) {
return item.phrase == phrase && item.persona == persona;
});
if (responses.length < 1) {
throw "Response doesn't exist! Add it by calling addResponse()";
}
var ran = rand(0, responses.length - 1);
return responses[ran];
}
};

2

package.json
{
"name": "sayhi-ai",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc