Skip to content

Commit

Permalink
Merge 731db17 into 57721d9
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianodltec authored Feb 13, 2021
2 parents 57721d9 + 731db17 commit 2b44bb7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vuejs-storage",
"name": "@lucianodltec/vuejs-storage",
"description": "Vue.js and Vuex plugin to persistence data with localStorage/sessionStorage",
"version": "3.1.0",
"version": "3.1.2",
"main": "./dist/vuejs-storage.cjs.js",
"module": "./dist/vuejs-storage.es.js",
"browser": "./dist/vuejs-storage.umd.js",
Expand Down
5 changes: 3 additions & 2 deletions src/merge.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// a simple object merge function implementation
export const isobj = x => typeof x === 'object' && !Array.isArray(x) && x !== null
export const isobj = x => typeof x === 'object' && !Array.isArray(x) && x !== null && x !== undefined
const merge = (target, source) => {
for (const key of Object.keys(source)) {
if (isobj(source[key])) {
if (!(key in target)) {
target[key] = source[key]
} else {
merge(target[key], source[key])
const t = target[key] = target[key] || {}
merge(t, source[key])
}
} else {
target[key] = source[key]
Expand Down

0 comments on commit 2b44bb7

Please sign in to comment.