Skip to content

Commit

Permalink
🐛 bug(path): fix branket key error
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Sep 12, 2019
1 parent e4f07ae commit 8d2aba7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ function parse (path: Path): ?Array<string> {
actions[APPEND]()
} else {
subPathDepth = 0
if (key === undefined) { return false }
key = formatSubPath(key)
if (key === false) {
return false
Expand Down
12 changes: 12 additions & 0 deletions test/unit/path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,16 @@ describe('path', () => {
assert.strictEqual(path.getPathValue(null, 'a.b'), null)
})
})

describe('Blanket: term', () => {
it('should not get null', () => {
assert.strictEqual(path.getPathValue({}, 'a.b.c[]'), null)
})
})

describe('Blanket: middle', () => {
it('should not get null', () => {
assert.strictEqual(path.getPathValue({}, 'a.b.c[]d'), null)
})
})
})

0 comments on commit 8d2aba7

Please sign in to comment.