Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit 8d2aba7

Browse files
committedSep 12, 2019
🐛 bug(path): fix branket key error
1 parent e4f07ae commit 8d2aba7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎src/path.js

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ function parse (path: Path): ?Array<string> {
194194
actions[APPEND]()
195195
} else {
196196
subPathDepth = 0
197+
if (key === undefined) { return false }
197198
key = formatSubPath(key)
198199
if (key === false) {
199200
return false

‎test/unit/path.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,16 @@ describe('path', () => {
7777
assert.strictEqual(path.getPathValue(null, 'a.b'), null)
7878
})
7979
})
80+
81+
describe('Blanket: term', () => {
82+
it('should not get null', () => {
83+
assert.strictEqual(path.getPathValue({}, 'a.b.c[]'), null)
84+
})
85+
})
86+
87+
describe('Blanket: middle', () => {
88+
it('should not get null', () => {
89+
assert.strictEqual(path.getPathValue({}, 'a.b.c[]d'), null)
90+
})
91+
})
8092
})

0 commit comments

Comments
 (0)
This repository has been archived.