-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathIsEquivalentTo.ps1
More file actions
21 lines (17 loc) · 652 Bytes
/
IsEquivalentTo.ps1
File metadata and controls
21 lines (17 loc) · 652 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<#
.SYNOPSIS
Attempts to Determine Ast Equivalence
.DESCRIPTION
Attempts to Determine if `$this` Ast element is the same as some `$Other` object.
If `$Other is a `[string]`, it will be converted into a `[ScriptBlock]`
If `$Other is a `[ScriptBlock]`, it will become the `[ScriptBlock]`s AST
If the types differ, `$other is not equivalent to `$this.
If the content is the same with all whitespace removed, it will be considered equivalent.
.NOTES
Due to the detection mechanism, IsEquivalentTo will consider strings with whitespace changes equivalent.
#>
param(
# The other item.
$Other
)
$this.Ast.IsEquivalentTo($other)