{"id":22309094,"url":"https://github.com/yevrag35/powershell-listfunctions","last_synced_at":"2026-01-27T15:31:05.753Z","repository":{"id":115814190,"uuid":"256828938","full_name":"Yevrag35/PowerShell-ListFunctions","owner":"Yevrag35","description":"A simple module that provides functions to manipulate and search through Arrays, Collections, Lists, and Sets.","archived":false,"fork":false,"pushed_at":"2025-12-11T03:41:09.000Z","size":1797,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-11T10:19:43.072Z","etag":null,"topics":["all","any","hashset","list","powershell","powershell-module"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yevrag35.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-04-18T18:50:29.000Z","updated_at":"2025-09-13T13:57:37.000Z","dependencies_parsed_at":"2023-12-22T19:21:37.557Z","dependency_job_id":"cb5657fe-8ba7-4dcd-873d-6a1f951087e4","html_url":"https://github.com/Yevrag35/PowerShell-ListFunctions","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Yevrag35/PowerShell-ListFunctions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yevrag35%2FPowerShell-ListFunctions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yevrag35%2FPowerShell-ListFunctions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yevrag35%2FPowerShell-ListFunctions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yevrag35%2FPowerShell-ListFunctions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yevrag35","download_url":"https://codeload.github.com/Yevrag35/PowerShell-ListFunctions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yevrag35%2FPowerShell-ListFunctions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28815397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["all","any","hashset","list","powershell","powershell-module"],"created_at":"2024-12-03T20:16:52.641Z","updated_at":"2026-01-27T15:31:05.738Z","avatar_url":"https://github.com/Yevrag35.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg height=\"30px\" src=\"./.icon/list-functions.png\" alt=\"ListFunctions\"\u003e\u003c/img\u003e ListFunctions for PowerShell\n\n[![version](https://img.shields.io/powershellgallery/v/ListFunctions.svg?include_prereleases)](https://www.powershellgallery.com/packages/ListFunctions)\n[![downloads](https://img.shields.io/powershellgallery/dt/ListFunctions.svg?label=downloads)](https://www.powershellgallery.com/stats/packages/ListFunctions?groupby=Version)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/097d27365fac4fc69ac2c45570db85d6)](https://www.codacy.com/gh/Yevrag35/PowerShell-ListFunctions/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=Yevrag35/PowerShell-ListFunctions\u0026amp;utm_campaign=Badge_Grade)\n\nThis is a simple module that provides functions to manipulate and search through Arrays, Collections, and Lists.  \n\n\"ListFunctions\" refers to the fact that some the functions are inspired by \u003ccode\u003eSystem.Collections.Generic.List\u003c/code\u003e's methods.\n\n## Assert Cmdlets (Any / All)\n\nSometimes you may want to just check if a specific collection has specific elements in it but don't need them themselves.\n\n### Assert-AnyObject\n\n_Aliases: __Any-Object__, __Any___\n\nThis cmdlet returns \u003ccode\u003etrue\u003c/code\u003e or \u003ccode\u003efalse\u003c/code\u003e if at least 1 element in the collection matches a condition - or - if no condition is provided, just if it contains at least 1 element.\n\nIf a scriptblock condition is specified, then it will substitute any of the following variables for each element: \u003ccode\u003e\\$\\_\u003c/code\u003e, \u003ccode\u003e\\$this\u003c/code\u003e, \u003ccode\u003e\\$psitem\u003c/code\u003e\n\n```powershell\n$array = @(1, 2, 3)\n\nif (($array | Any { $_ -gt 2})) {\n\n    # ... at least 1 element is greater than 2.\n}\n\nif (($array | Any-Object)) {\n\n    # ... at least 1 element exists.\n}\n```\n\n### Assert-AllObject(s)\n\nThis cmdlet returns \u003ccode\u003etrue\u003c/code\u003e or \u003ccode\u003efalse\u003c/code\u003e indicating whether __all__ elements in a collection match the specified condition.\n\nThe scriptblock condition will substitute any of the following variables for each element: \u003ccode\u003e\\$\\_\u003c/code\u003e, \u003ccode\u003e\\$this\u003c/code\u003e, \u003ccode\u003e\\$psitem\u003c/code\u003e\n\n```powershell\n$array = @(1, 2, 'John')\n\nif (-not ($array | All { $_ -is [int] })) {\n\n    #... at least 1 element is NOT an [int] object.\n}\n```\n\n---\n\n## Collection Constructors\n\nThese cmdlets provide easier ways of constructing the more nuanced, generic types within the `System.Collections.Generic` API namespace.\n\n### New-List\n\nConstructs and returns a list of type `[System.Collections.Generic.List[T]]` where `T` is the generic type defined through the `-GenericType` parameter (defaults to `[object]`).\n\n```powershell\n# Create a list of objects with the default capacity (0). \n# Like [System.Collections.ArrayList], objects of *any* type can be added.\n$list = New-List\n\n# Create a list of System.Guid objects with an initial capacity of 10,000.\n$list = New-List [guid] -Capacity 10000\n\n# Create a list of integers and provide it with the initial values to be added.\n$list = @(1, 2, '3') | New-List [int]\n# -or-\n$list = New-List [int] -InputObject @(3, '100', 56)\n\n```\n\n### New-HashSet\n\nConstructs and returns a list of type [`[System.Collections.Generic.HashSet[T]]`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1#remarks \"See MS Docs about HashSet[T]\") where `T` is the generic type defined through the `-GenericType` parameter (defaults to `[object]`).\n\nThis module makes utilizing a HashSet in PowerShell much easier through the use of \"ScriptBlock equality comparers\". With no pre-compiled or custom-defined `IEqualityComparer[T]` classes necessary, the `New-HashSet` cmdlet lets you define the equality comparison methods through normal PowerShell ScriptBlocks.\n\nLet's say you are importing a CSV where many values of a specific column are duplicates and you only need the first one of each:\n\n```csv\n\"Id\", \"Name\", \"Job\"\n\"1\", \"John\", \"The Guy\"\n\"1\", \"John\", \"The Guy?\"\n\"2\", \"Jane\", \"[redacted]\"\n```\n\nUsing data like this, we can create a custom HashSet where as long as both the `Id` and `Name` columns are the same, the __entire__ object should be treated as the same.\n\n```powershell\n$csv = Import-Csv -Path .\\Employees.csv\n\n# The equality scriptblock must return a [bool] (true/false) value.\n$equality = {   # $left and $right -or- $x and $y -- must be used.\n    $left.Name -eq $right.Name -and $left.Id -eq $right.Id\n}\n# The hashcode scriptblock must return an [int] value.\n$hashCode = {   # $_|$this|$psitem -- must be used.\n    $name = $_ | Select -ExpandProperty Name | % ToUpper\n    $id = ($_ | Select -ExpandProperty Id) -as [int]\n\n    [System.HashCode]::Combine($name, $id)\n}\n\n$set = New-HashSet -EqualityScript $equality -HashCodeScript $hashCode -Capacity 2\n\n$set.Add($csv[0])\n# Outputs 'true'\n\n$set.Add($csv[1])\n# Outputs 'false' and is not added to the set.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyevrag35%2Fpowershell-listfunctions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyevrag35%2Fpowershell-listfunctions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyevrag35%2Fpowershell-listfunctions/lists"}