feat: add flag createIfNode for ShellNode#getProp

This commit is contained in:
LeoYuan 袁力皓 2022-06-28 10:05:16 +08:00 committed by 林熠
parent 8e5fcd1d59
commit 152a24d655

View File

@ -330,8 +330,8 @@ export default class Node {
* @param path a / a.b / a.0 * @param path a / a.b / a.0
* @returns * @returns
*/ */
getProp(path: string): Prop | null { getProp(path: string, createIfNone = true): Prop | null {
return Prop.create(this[nodeSymbol].getProp(path)); return Prop.create(this[nodeSymbol].getProp(path, createIfNone));
} }
/** /**
@ -340,7 +340,7 @@ export default class Node {
* @returns * @returns
*/ */
getPropValue(path: string) { getPropValue(path: string) {
return this.getProp(path)?.getValue(); return this.getProp(path, false)?.getValue();
} }
/** /**