A PowerShell module for formatting objects using Hafr.
The Hafr powershell module is available via the Powershell Gallery:
Install-Module Hafr
The module consists of a CmdLet called Format-Hafr
.
It accepts a PowerShell object. The object can be sent in via the pipeline.
This is a Hafr template that will be applied to the model.
$user = @{ Firstname = "John Alexander"; Lastname = "Doe" }
$user | Format-Hafr "{ Firstname | replace(' ', '.') }.{ Lastname }"
# Output:
# John.Alexander.Doe
$user = @{ Firstname = "John Alexander"; Lastname = "Doe" }
Format-Hafr -Model $user -Template "{ Firstname | replace(' ', '.') }.{ Lastname }"
# Output:
# John.Alexander.Doe
$user1 = @{ Firstname = "John Alexander"; Lastname = "Doe" }
$user2 = @{ Firstname = "Carl Benjamin"; Lastname = "Lewis" }
$users = $user1, $user2
$users | Format-Hafr "{ Firstname | replace(' ', '.') }.{ Lastname }"
# Output:
# John.Alexander.Doe
# Carl.Benjamin.Lewis