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

@codescouts/vue-store-beta

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codescouts/vue-store-beta - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

dist/index.cjs.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("pinia"),u=(t,s)=>(Object.entries(s).forEach(e=>{if(typeof e[1]=="object"&&t[e[0]]){const n=t[e[0]];t[e[0]]=u(n,e[1])}else t[e[0]]=e[1]}),t),S=(t,s)=>{const e=new t;return u(e,s),e},l=(t,s)=>S(t,s),d=(t,s,e)=>{const n=Object.keys(t)[0],c=t[n];return(e?()=>e(c,Object.assign):()=>l(s,c))()},h=t=>{const s={withPersist:!1,entityType:void 0,factory:void 0},e=r=>typeof r=="string"?r:r.name,n=()=>{let r=new t;const{withPersist:i,entityType:a,factory:g}=s,f=e(a);if(i){let o;try{o=JSON.stringify(localStorage.getItem(f))}catch{o={}}r=d(o,a,g)}return y.defineStore(t.name,{state:()=>({state:r}),actions:{save(o){this.$patch({state:o}),i&&localStorage.setItem(f,JSON.stringify(o))},get(){const o=this.$state.state;return l(t,o)}}})};function c(r,i){return s.entityType=r,s.withPersist=!0,s.factory=i,{build:n}}return{build:n,withPersist:c}};exports.create=h;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("pinia"),l=(t,s)=>(Object.entries(s).forEach(e=>{if(typeof e[1]=="object"&&t[e[0]]){const n=t[e[0]];t[e[0]]=l(n,e[1])}else t[e[0]]=e[1]}),t),y=(t,s)=>{const e=new t;return l(e,s),e},S=(t,s)=>y(t,s),h=(t,s,e)=>{const n=Object.keys(t)[0],i=t[n];return(e?()=>e(i,Object.assign):()=>S(s,i))()},p=t=>{const s={withPersist:!1,entityType:void 0,factory:void 0},e=r=>typeof r=="string"?r:r.name,n=()=>{let r=new t;const{withPersist:c,entityType:f,factory:d}=s,u=e(f);if(c){const o=localStorage.getItem(u);if(o){let a;try{a=JSON.parse(o)}catch{a={}}r=h(a,f,d)}}return g.defineStore(t.name,{state:()=>({state:r}),actions:{save(o){this.$patch({state:o}),c&&localStorage.setItem(u,JSON.stringify(o))},get(){const o=this.$state.state;return S(t,o)}}})};function i(r,c){return s.entityType=r,s.withPersist=!0,s.factory=c,{build:n}}return{build:n,withPersist:i}};exports.create=p;

@@ -1,6 +0,6 @@

import { defineStore as y } from "pinia";
const l = (t, s) => (Object.entries(s).forEach((e) => {
import { defineStore as g } from "pinia";
const u = (t, s) => (Object.entries(s).forEach((e) => {
if (typeof e[1] == "object" && t[e[0]]) {
const n = t[e[0]];
t[e[0]] = l(n, e[1]);
t[e[0]] = u(n, e[1]);
} else

@@ -10,7 +10,7 @@ t[e[0]] = e[1];

const e = new t();
return l(e, s), e;
}, u = (t, s) => h(t, s), S = (t, s, e) => {
return u(e, s), e;
}, S = (t, s) => h(t, s), y = (t, s, e) => {
const n = Object.keys(t)[0], i = t[n];
return (e ? () => e(i, Object.assign) : () => u(s, i))();
}, w = (t) => {
return (e ? () => e(i, Object.assign) : () => S(s, i))();
}, O = (t) => {
const s = {

@@ -22,13 +22,16 @@ withPersist: !1,

let r = new t();
const { withPersist: c, entityType: a, factory: g } = s, f = e(a);
const { withPersist: c, entityType: f, factory: d } = s, l = e(f);
if (c) {
let o;
try {
o = JSON.stringify(localStorage.getItem(f));
} catch {
o = {};
const o = localStorage.getItem(l);
if (o) {
let a;
try {
a = JSON.parse(o);
} catch {
a = {};
}
r = y(a, f, d);
}
r = S(o, a, g);
}
return y(t.name, {
return g(t.name, {
state: () => ({

@@ -39,7 +42,7 @@ state: r

save(o) {
this.$patch({ state: o }), c && localStorage.setItem(f, JSON.stringify(o));
this.$patch({ state: o }), c && localStorage.setItem(l, JSON.stringify(o));
},
get() {
const o = this.$state.state;
return u(t, o);
return S(t, o);
}

@@ -55,3 +58,3 @@ }

export {
w as create
O as create
};
{
"name": "@codescouts/vue-store-beta",
"version": "1.0.2",
"version": "1.0.3",
"type": "module",

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

@@ -22,12 +22,16 @@ import { defineStore } from "pinia";

if (withPersist) {
let persistedState;
try {
persistedState = JSON.stringify(localStorage.getItem(storageKey));
} catch {
persistedState = {};
}
const restoredRawState = localStorage.getItem(storageKey);
const restoredState = merge<T>(persistedState, entityType, factory);
if (restoredRawState) {
let persistedState;
try {
persistedState = JSON.parse(restoredRawState);
} catch {
persistedState = {};
}
initialState = restoredState;
const restoredState = merge<T>(persistedState, entityType, factory);
initialState = restoredState;
}
}

@@ -34,0 +38,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