Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ellipsis-default-storage

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ellipsis-default-storage - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

74

index.js
var request = require('request');
function findMissingArgs(keysToEnsure, args) {
var missing = [];
keysToEnsure.forEach(function(key) {
if (args[key] === undefined) {
missing.push(key)
}
});
return missing;
}
module.exports = {
putItem: function (itemId, itemType, item, onSuccess, onError, context) {
request.
post({
url: context.apiBaseUrl + "/put_item",
form: {itemId: itemId, itemType: itemType, token: context.token, item: item}
}, function (error, response, body) {
if (!error && response.statusCode == 200) {
onSuccess(response, body);
} else {
onError(error);
putItem: function (args) {
var missing = findMissingArgs(["itemId", "itemType", "item", "context"], args);
if (missing.length > 0) {
onError("Missing values for: " + missing.join(", "));
} else {
request.
post({
url: args.context.apiBaseUrl + "/put_item",
form: {itemId: args.itemId, itemType: args.itemType, token: args.context.token, item: args.item}
}, function (error, response, body) {
if (!error && response.statusCode == 200) {
if (args.onSuccess) {
args.onSuccess(response, body);
}
} else {
if (args.onError) {
args.onError(error);
}
}
}
}
);
);
}
},
getItem: function (itemId, itemType, onSuccess, onError, context) {
request.
get(
context.apiBaseUrl + "/get_item/" + itemId + "/" + itemType + "/" + context.token,
function (error, response, body) {
if (!error && response.statusCode == 200) {
onSuccess(response, body);
} else {
onError(error);
getItem: function (args) {
var missing = findMissingArgs(["itemId", "itemType", "context"], args);
if (missing.length > 0) {
onError("Missing values for: " + missing.join(", "));
} else {
request.
get(
args.context.apiBaseUrl + "/get_item/" + args.itemId + "/" + args.itemType + "/" + args.context.token,
function (error, response, body) {
if (!error && response.statusCode == 200) {
if (args.onSuccess) {
args.onSuccess(response, body);
}
} else {
if (args.onError) {
args.onError(error);
}
}
}
}
);
);
}
}
};
{
"name": "ellipsis-default-storage",
"version": "0.1.4",
"version": "0.1.5",
"description": "Interface to the default storage for Ellipsis behaviors",

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

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