Skip to content

Commit

Permalink
feat: added get method
Browse files Browse the repository at this point in the history
  • Loading branch information
kouts committed May 13, 2021
1 parent 44c9e86 commit 8ed8f25
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dist/cjs/pathStoreVuexPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions dist/es/pathStoreVuexPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions dist/umd/pathStoreVuexPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/pathStoreVuexPlugin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/pathStoreVuexPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const pathStoreVuexPlugin = (store) => {
toggle(path) {
store.commit('toggle', { path })
},
get(path) {
return path ? getByPath(store.state, path) : store.state
},
del(path) {
store.commit('del', { path })
},
Expand Down

0 comments on commit 8ed8f25

Please sign in to comment.