Skip to content

Commit

Permalink
feat: Emoji.GetPagingParameters ( Fixes #32 )
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating authored and StartAutomating committed Feb 21, 2024
1 parent f2a092a commit 8e7c4ba
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions Emoji.types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,9 @@ if ($Number) {
$allNamedEmoji = $allNamedEmoji | Where-Object Number -In $Number
}

$selectSplat = @{}
if (
($PSCmdlet.PagingParameters.Skip -as [int]) -or
($PSCmdlet.PagingParameters.First -as [int])
) {
if ($PSCmdlet.PagingParameters.Skip) {
$selectSplat.Skip = $PSCmdlet.PagingParameters.Skip
}

if ($PSCmdlet.PagingParameters.First) {
$selectSplat.First = $PSCmdlet.PagingParameters.First
}
}

$selectSplat = $Emoji.GetPagingParameters($PSCmdlet.PagingParameters)
if ($name -or $number) {
if ($selectSplat.Count) {
if ($selectSplat.Count -gt 1) {
$allNamedEmoji | Select-Object @selectSplat
} else {
$allNamedEmoji
Expand All @@ -125,6 +112,38 @@ else {
}


</Script>
</ScriptMethod>
<ScriptMethod>
<Name>GetPagingParameters</Name>
<Script>
&lt;#
.SYNOPSIS
Gets the paging parameters
.DESCRIPTION
Gets the paging parameters as a Dictionary for Select-Object.
.LINK
Select-Object
#&gt;
param(
$Parameter
)

$SelectParameters = [Ordered]@{}

if ($Parameter.First -as [int]) {
$SelectParameters.First = $Parameter.First -as [int]
}

if ($Parameter.Skip -as [int]) {
$SelectParameters.Skip = $Parameter.Skip -as [int]
}

return $SelectParameters




</Script>
</ScriptMethod>
<ScriptMethod>
Expand Down

0 comments on commit 8e7c4ba

Please sign in to comment.