Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-Array {
- Param (
- [Parameter(Mandatory, Position = 0)] [scriptblock] $Scriptblock
- )
- $Result = & $Scriptblock
- if (0 -eq $Result) { return , (, $Result) }
- if (-not $Result) { return , @() }
- if ($Result -is [array]) {
- return (. {if ($Result.Count -eq 1) { , $Result } else { $Result }})
- }
- return , @($Result)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement