Skip to content

Commit 152a24d

Browse files
LeoYuanJackLian
authored andcommitted
feat: add flag createIfNode for ShellNode#getProp
1 parent 8e5fcd1 commit 152a24d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/shell/src/node.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ export default class Node {
330330
* @param path 属性路径,支持 a / a.b / a.0 等格式
331331
* @returns
332332
*/
333-
getProp(path: string): Prop | null {
334-
return Prop.create(this[nodeSymbol].getProp(path));
333+
getProp(path: string, createIfNone = true): Prop | null {
334+
return Prop.create(this[nodeSymbol].getProp(path, createIfNone));
335335
}
336336

337337
/**
@@ -340,7 +340,7 @@ export default class Node {
340340
* @returns
341341
*/
342342
getPropValue(path: string) {
343-
return this.getProp(path)?.getValue();
343+
return this.getProp(path, false)?.getValue();
344344
}
345345

346346
/**

0 commit comments

Comments
 (0)