Skip to content

Commit 8b8fe19

Browse files
feat: Turtle.get/set_Steps performance ( Fixes #159 )
1 parent 480e8de commit 8b8fe19

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Types/Turtle/get_Steps.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
if ($this.'.Steps') {
2-
return $this.'.Steps'
1+
if (-not $this.'.Steps') {
2+
$this.psobject.properties.add(
3+
[psnoteproperty]::new(
4+
'.Steps', [Collections.Generic.List[string]]::new()
5+
), $false
6+
)
37
}
4-
return ,@()
8+
return ,$this.'.Steps'

Types/Turtle/set_Steps.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,11 @@ param(
1111
$Steps
1212
)
1313

14-
$this | Add-Member -MemberType NoteProperty -Force -Name '.Steps' -Value @($Steps)
14+
if (-not $this.'.Steps') {
15+
$this | Add-Member -MemberType NoteProperty -Force -Name '.Steps' -Value @(
16+
[Collections.Generic.List[string]]::new($Steps)
17+
)
18+
} else {
19+
$this.'.Steps' = $steps
20+
}
21+

0 commit comments

Comments
 (0)