Skip to content

Commit

Permalink
Bug fix when using .then() on root json node
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Ottaviani Aragão committed Sep 2, 2017
1 parent 3de27f9 commit c7bec53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
var where = path[path.length - 1];
var parent = path[path.length - 2];

if (!parent) {
state[where] = value;
if( !where ){
state = value;
pointer = state;
}else if(!parent) {
state[ where ] = value;
pointer = value;
} else {
path.reduce(function (acc, key) {
Expand Down
5 changes: 4 additions & 1 deletion source.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export default state =>{
let where = path[ path.length-1 ]
let parent = path[ path.length-2 ]

if(!parent) {
if( !where ){
state = value
pointer = state
}else if(!parent) {
state[ where ] = value
pointer = value
}else{
Expand Down
2 changes: 1 addition & 1 deletion walker.min.js

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

0 comments on commit c7bec53

Please sign in to comment.