Use more simple check for existence of member

This commit is contained in:
Matt Martz 2014-06-17 15:44:53 -05:00
parent 14dab9870b
commit 6cda35e1d3
4 changed files with 6 additions and 6 deletions

View file

@ -7,7 +7,7 @@ If ($args.Length -gt 0)
} }
$data = 'pong'; $data = 'pong';
If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data') If ($params.data.GetType)
{ {
$data = $params.data; $data = $params.data;
} }

View file

@ -8,13 +8,13 @@ If ($args.Length -gt 0)
} }
$src = ''; $src = '';
If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'src') If ($params.src.GetType)
{ {
$src = $params.src; $src = $params.src;
} }
Else Else
{ {
If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'path') If ($params.path.GetType)
{ {
$src = $params.path; $src = $params.path;
} }

View file

@ -8,13 +8,13 @@ If ($args.Length -gt 0)
} }
$path = ''; $path = '';
If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'path') If ($params.path.GetType)
{ {
$path = $params.path; $path = $params.path;
} }
$get_md5 = $TRUE; $get_md5 = $TRUE;
If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'get_md5') If ($params.get_md5.GetType)
{ {
$get_md5 = $params.get_md5; $get_md5 = $params.get_md5;
} }

View file

@ -7,7 +7,7 @@ If ($args.Length -gt 0)
} }
$data = 'pong'; $data = 'pong';
If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data') If ($params.data.GetType)
{ {
$data = $params.data; $data = $params.data;
} }