Skip to content

Commit

Permalink
Add-MyMember
Browse files Browse the repository at this point in the history
  • Loading branch information
rulasg committed May 24, 2023
1 parent 3a3457a commit d8cdab3
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Docs.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ function global:Get-DocsName{
}

function global:Get-DocsNameSample{
[CmdletBinding(SupportsShouldProcess)]
[CmdletBinding()]
param(
[parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)][Alias("PSPath")][string[]]$Path,
[parameter(ValueFromPipelineByPropertyName)][string]$Date,
Expand Down Expand Up @@ -1146,4 +1146,23 @@ function Format-DocsName {
$input | ForEach-Object { $_.Name() }
} # Export-ModuleMember -Function Format-DocsName -Alias "fname"

#endregion Formats
#endregion Formats

#region utils

function Add-MyMember{
[CmdletBinding()]
param(
[parameter(Mandatory,ValueFromPipeline)][Object] $object,
[parameter(Mandatory)][string]$NotePropertyName,
[parameter(Mandatory)][string]$NotePropertyValue
)

if ($Object.$NotePropertyName) {
$Object.$NotePropertyName = $NotePropertyValue
} else {
$object | Add-Member -NotePropertyName $NotePropertyName -NotePropertyValue $NotePropertyValue
}
}

#endregion utils

0 comments on commit d8cdab3

Please sign in to comment.