add node existence check to NodePath#has - fixes #2800

This commit is contained in:
Sebastian McKenzie 2015-11-04 23:38:14 +00:00
parent 1bfb7039e9
commit f4fe578a6c

View File

@ -70,7 +70,7 @@ export function matchesPattern(pattern: string, allowPartial?: boolean): boolean
*/
export function has(key): boolean {
let val = this.node[key];
let val = this.node && this.node[key];
if (val && Array.isArray(val)) {
return !!val.length;
} else {