Socket
Socket
Sign inDemoInstall

@kano/kbc-utils

Package Overview
Dependencies
Maintainers
13
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kano/kbc-utils - npm Package Compare versions

Comparing version 4.23.0-alpha.0 to 4.23.1-alpha.0

14

lib/utils/storage.d.ts

@@ -1,12 +0,8 @@

interface IOpts {
env?: boolean;
userId?: string;
}
declare class Storage {
export declare class Storage {
env?: string;
constructor();
setKey: (base: string, env?: boolean, userId?: string) => string;
read: (baseKey: string, opts?: IOpts) => void;
write: (baseKey: string, data: string, opts?: IOpts) => void;
remove: (baseKey: string, opts?: IOpts) => Promise<void>;
setKey: (base: string, userId?: string) => string;
read: (baseKey: string, userId?: string) => string;
write: (baseKey: string, data: string, userId?: string) => void;
remove: (baseKey: string, userId?: string) => Promise<void>;
}

@@ -13,0 +9,0 @@ export default Storage;

@@ -13,20 +13,21 @@ "use strict";

constructor() {
this.setKey = (base, env, userId) => {
return `${base}${env ? `_${this.env}` : ''}${userId ? `_${userId}` : ''}`;
this.setKey = (base, userId) => {
return `${base}_${this.env}${userId ? `_${userId}` : ''}`;
};
this.read = (baseKey, opts) => {
const key = this.setKey(baseKey, opts.env, opts.userId);
localStorage.getItem(key);
this.read = (baseKey, userId) => {
const key = this.setKey(baseKey, userId);
return localStorage.getItem(key);
};
this.write = (baseKey, data, opts) => {
const key = this.setKey(baseKey, opts.env, opts.userId);
this.write = (baseKey, data, userId) => {
const key = this.setKey(baseKey, userId);
localStorage.setItem(key, data);
};
this.remove = (baseKey, opts) => __awaiter(this, void 0, void 0, function* () {
const key = this.setKey(baseKey, opts.env, opts.userId);
localStorage.removeItem(key);
this.remove = (baseKey, userId) => __awaiter(this, void 0, void 0, function* () {
const key = this.setKey(baseKey, userId);
return localStorage.removeItem(key);
});
this.env = process.env.NODE_ENV;
this.env = process.env.NODE_ENV || 'no-env';
}
}
exports.Storage = Storage;
exports.default = Storage;

@@ -33,0 +34,0 @@ const read = (key) => localStorage.getItem(key);

{
"name": "@kano/kbc-utils",
"version": "4.23.0-alpha.0",
"version": "4.23.1-alpha.0",
"description": "Utilities functionality for boilerplate mini apps",

@@ -35,3 +35,3 @@ "author": "Kano Computing",

},
"gitHead": "8804863abc907429ae6ba0e8bdaffa72504abb7f"
"gitHead": "0ed35b79bccf44a2c96ecfb87a6011cd20a4f466"
}

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