Skip to content

Commit

Permalink
fixed updated vueset to handle nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
bhoriuchi committed Jan 10, 2018
1 parent c26e125 commit 65df5b7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function vueSet(object, path, value) {
var key = parts.shift();
if (!parts.length) {
Vue.set(obj, key, value);
} else if (!hasPath(obj, key)) {
} else if (!hasPath(obj, key) || obj[key] === null) {
Vue.set(obj, key, key === 'number' ? [] : {});
}
obj = obj[key];
Expand Down
2 changes: 1 addition & 1 deletion src/vue-deepset.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function vueSet (object, path, value) {
const key = parts.shift()
if (!parts.length) {
Vue.set(obj, key, value)
} else if (!_.hasPath(obj, key)) {
} else if (!_.hasPath(obj, key) || obj[key] === null) {
Vue.set(obj, key, key === 'number' ? [] : {})
}
obj = obj[key]
Expand Down
2 changes: 1 addition & 1 deletion vue-deepset.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function vueSet(object, path, value) {
var key = parts.shift();
if (!parts.length) {
Vue.set(obj, key, value);
} else if (!hasPath(obj, key)) {
} else if (!hasPath(obj, key) || obj[key] === null) {
Vue.set(obj, key, key === 'number' ? [] : {});
}
obj = obj[key];
Expand Down
2 changes: 1 addition & 1 deletion vue-deepset.min.js

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

0 comments on commit 65df5b7

Please sign in to comment.