Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code change to work with Set-StrictMode 2.0+ #3

Closed
wants to merge 1 commit into from
Closed

Code change to work with Set-StrictMode 2.0+ #3

wants to merge 1 commit into from

Conversation

mcclimont
Copy link

StrictMode 2.0 introduced "Cannot call non-existent properties on objects", altered code to accomodate this strict mode.
Reference: https://blogs.technet.microsoft.com/heyscriptingguy/2014/12/03/enforce-better-script-practices-by-using-set-strictmode/

StrictMode 2.0 introduced "Cannot call non-existent properties on objects", altered code to accomodate this strict mode.
Reference: https://blogs.technet.microsoft.com/heyscriptingguy/2014/12/03/enforce-better-script-practices-by-using-set-strictmode/
@iRon7
Copy link
Owner

iRon7 commented Feb 6, 2019

Thanks a lot for the suggestion, I will incorporate this in my next version (almost ready) and put this in my standard tests.

@iRon7 iRon7 self-assigned this Feb 6, 2019
@iRon7
Copy link
Owner

iRon7 commented Feb 8, 2019

I have updated the Join-Object cmdlet and added Set-StrictMode -Version 2.0 to my tests.
I didn't add Set-StrictMode -Version 2.0 to the Join-Object cmdlet as users might easily add a Merge-Expression that could cause a Set-StrictMode -Version 2.0 error, e.g. -MergeExpression @{$Left.$_, $Right.$_} could fail because the $Left and/or $Right object properties might not exist in the outer joins.
For this, I have added two additional objects for the MergeExpression: $LeftOrVoid and $RightOrVoid which suppliy the concerned $Left or $Right object if existing, otherwise it will refer to an object which all properties values set to $Null.

@iRon7 iRon7 closed this Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants