Skip to content

Commit

Permalink
feat: add flag createIfNode for ShellNode#getProp
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoYuan authored and JackLian committed Jun 28, 2022
1 parent 8e5fcd1 commit 152a24d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/shell/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ export default class Node {
* @param path 属性路径,支持 a / a.b / a.0 等格式
* @returns
*/
getProp(path: string): Prop | null {
return Prop.create(this[nodeSymbol].getProp(path));
getProp(path: string, createIfNone = true): Prop | null {
return Prop.create(this[nodeSymbol].getProp(path, createIfNone));
}

/**
Expand All @@ -340,7 +340,7 @@ export default class Node {
* @returns
*/
getPropValue(path: string) {
return this.getProp(path)?.getValue();
return this.getProp(path, false)?.getValue();
}

/**
Expand Down

0 comments on commit 152a24d

Please sign in to comment.