Created
September 18, 2019 18:16
-
-
Save mikepfeiffer/9ff8a952088de4f03c069fdb5447ec0d to your computer and use it in GitHub Desktop.
Demo that shows how to use a utility function inside a PS Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#private function | |
function new-baseEncode ($pat) { | |
$encoded = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes((":{0}" -f $pat))) | |
Write-Output $encoded | |
} | |
#public function | |
function New-EncodedMessage ($name, $data) { | |
$encoded = new-baseEncode $data | |
Write-Output @{ | |
Name = $name | |
EncodedMessage = $encoded | |
} | |
} | |
#making the public function visible to module consumers | |
Export-ModuleMember New-EncodedMessage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment