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

storeit

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storeit - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

lib/errorMessages.js

27

lib/Storeit.js

@@ -12,2 +12,3 @@ "use strict";

var EventName = require("./EventName");
var StoreitError = require("./StoreitError");

@@ -19,5 +20,11 @@ var NS_SEPARATOR_CHAR = "#";

function throwUninitializedError() {
throw new Error("[Storeit] you must first call `load`");
throw new StoreitError(StoreitError.loadUninitialized);
}
function throwIfUndefined(value) {
if (value === undefined) {
throw new StoreitError(StoreitError.undefinedValue);
}
}
function Storeit(namespace, storageProvider, logger) {

@@ -28,3 +35,3 @@ var that = this;

if (namespace.indexOf(NS_SEPARATOR_CHAR) !== -1) {
throw new Error("[Storeit] namespace can not contain a hash character (#)");
throw new StoreitError(StoreitError.invalidNamespace);
}

@@ -46,3 +53,3 @@

if (typeof key !== "string") {
throw new TypeError("[Storeit] key must be a string.");
throw new StoreitError(StoreitError.invalidKey);
}

@@ -170,5 +177,3 @@ }

set: function (value) {
if (typeof value === "undefined") {
throw new TypeError("[Storeit] metadata value must not be undefined.");
}
throwIfUndefined(value);
setMetadata(key, value);

@@ -181,3 +186,3 @@ },

} else {
throw new Error("[Storeit.metadata] key doesn't exist");
throw new StoreitError(StoreitError.nonexistentKey);
}

@@ -187,5 +192,3 @@ };

that.set = function (key, value, metadata) {
if (typeof value === "undefined") {
throw new TypeError("[Storeit] value must not be undefined.");
}
throwIfUndefined(value);
var results = set(key, value, metadata);

@@ -216,3 +219,3 @@ if (results.action === Action.added) {

} else {
throw new Error("[Storeit.delete] key doesn't exist");
throw new StoreitError(StoreitError.nonexistentKey);
}

@@ -232,3 +235,2 @@ }

that.clear = function () {
throwIfUninitialized();
if (options.publishRemoveOnClear) { // Publish removed events only for things that the domain knows about.

@@ -285,3 +287,4 @@ Object.keys(cache).reverse().forEach(deleteKey);

Storeit.EventName = EventName;
Storeit.StoreitError = StoreitError;
module.exports = Storeit;
{
"name": "storeit",
"version": "1.0.4",
"version": "1.0.5",
"description": "A key/value storage system that publishes events.",

@@ -11,3 +11,10 @@ "main": "./lib/Storeit.js",

"keywords": [
"storeit"
"storeit",
"webstorage",
"localstorage",
"sessionstorage",
"key",
"value",
"pair",
"kvp"
],

@@ -14,0 +21,0 @@ "contributors": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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