From 8ed8f251f751d29f1f35d37eb47028586690943b Mon Sep 17 00:00:00 2001 From: Kouts Date: Thu, 13 May 2021 22:39:10 +0300 Subject: [PATCH] feat: added get method --- dist/cjs/pathStoreVuexPlugin.js | 3 +++ dist/es/pathStoreVuexPlugin.js | 3 +++ dist/umd/pathStoreVuexPlugin.js | 3 +++ dist/umd/pathStoreVuexPlugin.min.js | 2 +- src/pathStoreVuexPlugin.js | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dist/cjs/pathStoreVuexPlugin.js b/dist/cjs/pathStoreVuexPlugin.js index b252db5..b1c4a6a 100644 --- a/dist/cjs/pathStoreVuexPlugin.js +++ b/dist/cjs/pathStoreVuexPlugin.js @@ -240,6 +240,9 @@ var pathStoreVuexPlugin = function pathStoreVuexPlugin(store) { path: path }); }, + get: function get(path) { + return path ? getByPath(store.state, path) : store.state; + }, del: function del(path) { store.commit('del', { path: path diff --git a/dist/es/pathStoreVuexPlugin.js b/dist/es/pathStoreVuexPlugin.js index 2d1f38d..97a9147 100644 --- a/dist/es/pathStoreVuexPlugin.js +++ b/dist/es/pathStoreVuexPlugin.js @@ -232,6 +232,9 @@ var pathStoreVuexPlugin = function pathStoreVuexPlugin(store) { path: path }); }, + get: function get(path) { + return path ? getByPath(store.state, path) : store.state; + }, del: function del(path) { store.commit('del', { path: path diff --git a/dist/umd/pathStoreVuexPlugin.js b/dist/umd/pathStoreVuexPlugin.js index 1930bb1..b6e249b 100644 --- a/dist/umd/pathStoreVuexPlugin.js +++ b/dist/umd/pathStoreVuexPlugin.js @@ -240,6 +240,9 @@ path: path }); }, + get: function get(path) { + return path ? getByPath(store.state, path) : store.state; + }, del: function del(path) { store.commit('del', { path: path diff --git a/dist/umd/pathStoreVuexPlugin.min.js b/dist/umd/pathStoreVuexPlugin.min.js index 6573416..efeb982 100644 --- a/dist/umd/pathStoreVuexPlugin.min.js +++ b/dist/umd/pathStoreVuexPlugin.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pathStoreVuexPlugin={},t.Vue)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(e);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r { toggle(path) { store.commit('toggle', { path }) }, + get(path) { + return path ? getByPath(store.state, path) : store.state + }, del(path) { store.commit('del', { path }) },