CARVIEW |
Select Language
HTTP/2 301
date: Wed, 23 Jul 2025 22:17:02 GMT
content-type: text/html; charset=utf-8
content-length: 0
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
location: https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Enumerable
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
set-cookie: _gh_sess=q64NCeM%2F00HaGVWTHRS%2BFqogIraPeQhOdC0%2Bj1LEOqhoNwMKgznJPdjmH3Q3zV8XH4kERRC8jcdpLvvA5VoEtMLPzKF7lEL0sHXTiQQ66j5B04AKWoHO8B5EapJKvsVpZU73LuEAmJTFebYzudN%2FfTLEkWXJmdFBtXOWdKfFZ26zMmYZ09qGPoH6oWQgvffMhNy%2FpSSb5zwYq7YPK%2FW4n7HfDNNn6ICrEc1q1f0TEsf9h1bXEcAOu80Jf1xSOGfDQZGVG77Cc5LLuUJdcBbl8g%3D%3D--%2Fql87O6JMo7heWog--I7GYPa3MuV9FQu2M%2FbON8g%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.560171698.1753309022; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 22:17:02 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 22:17:02 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: B058:23E99C:17A6D:240B3:68815F5E
HTTP/2 200
date: Wed, 23 Jul 2025 22:17:03 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"60c77771c2c83b93e66a56958b7338a8"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
x-github-request-id: B058:23E99C:17A88:240D8:68815F5E
Enumerable · Handlebars-Net/Handlebars.Net.Helpers Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Enumerable
Stef Heyenrath edited this page Jan 26, 2025
·
14 revisions
These block helpers allow for some simple selecting, querying, filtering on arrays, lists and collections.
- Enumerable.Average
- Enumerable.Count
- Enumerable.Distinct
- Enumerable.IsEmpty
- Enumerable.IsFirst
- Enumerable.IsLast
- Enumerable.Max
- Enumerable.Min
- Enumerable.Page
- Enumerable.Reverse
- Enumerable.Select
- Enumerable.Skip
- Enumerable.Sum
- Enumerable.Take
Summary | Return a collection of distinct elements from an array |
Returns | Updated collection of distinct elements |
Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
Parameters | |
array | Array of objects to make distinct |
Context
{
"array": [
"one",
"two",
"two",
"two",
"three"
],
"badInput": {
"something": true
}
}
Usage
<strong>result:</strong>
{{#Enumerable.Distinct array}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Distinct}}
{{#Enumerable.Distinct badInput}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Distinct}}
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: one</li>
<li>Value: two</li>
<li>Value: three</li>
</ul>
<strong>False</strong>
Summary | Determine whether or not the object passed in is the first element in the passed in array |
Returns | Whether or not the object is the first element in the array |
Remarks | |
Parameters | |
array | Array of objects to inspect |
object | Object to match on |
Context
{
"array": [
"one",
"two",
"three"
]
}
Usage
<strong>result:</strong>
{{#Enumerable.IsFirst array "one"}}
<strong>True</strong>
{{else}}
<strong>False</strong>
{{/IsFirst}}
{{#Enumerable.IsFirst array "two"}}
<strong>True</strong>
{{else}}
<strong>False</strong>
{{/IsFirst}}
Returns
<strong>result:</strong>
<strong>True</strong>
<strong>False</strong>
Summary | Determine whether or not the object passed in is the last element in the passed in array |
Returns | Whether or not the object is the last element in the array |
Remarks | |
Parameters | |
array | Array of objects to inspect |
object | Object to match on |
Context
{
"array": [
"one",
"two",
"three"
]
}
Usage
<strong>result:</strong>
{{#Enumerable.IsLast array "one"}}
<strong>True</strong>
{{else}}
<strong>False</strong>
{{/IsLast}}
{{#Enumerable.IsLast array "three"}}
<strong>True</strong>
{{else}}
<strong>False</strong>
{{/IsLast}}
Returns
<strong>result:</strong>
<strong>False</strong>
<strong>True</strong>
Summary | Return a collection of elements from an array, skipping N elements |
Returns | A single page worth of elements |
Remarks | If object is not an array, if page number is not passed in, or if page number or countPerPage are <= 0, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
Parameters | |
array | Array of objects to evaluate |
pageNumber | Page number |
countPerPage | Number of elements per page, default 0 |
Context
{
"array": [
"one",
"two",
"three",
"four",
"five"
],
"badInput": {
"something": true
}
}
Usage
<strong>result:</strong>
{{#Enumerable.Page array 2 2}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Page}}
{{#Enumerable.Page badInput 1 3}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Page}}
{{#Enumerable.Page array 1 -1}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Page}}
{{#Enumerable.Page array 0 2}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Page}}
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: three</li>
<li>Value: four</li>
</ul>
<strong>False</strong>
<strong>False</strong>
<strong>False</strong>
Summary | Reverses the order of an array |
Returns | An array with the element order reversed |
Remarks | If object is not an array, if page number is not passed in, or if page number or countPerPage are <= 0, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
Parameters | |
input | Array of elements to reverse |
Context
{
"array": [
"one",
"two",
"three",
"four",
"five"
],
"badInput": {
"something": true
}
}
Usage
<strong>Result:</strong>
{{#Enumerable.Reverse array}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Reverse}}
<strong>Input Not an Array Result:</strong>
{{#Enumerable.Reverse badInput}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Reverse}}
Returns
<strong>Result:</strong>
<strong>True</strong>
<ul>
<li>Value: five</li>
<li>Value: four</li>
<li>Value: three</li>
<li>Value: two</li>
<li>Value: one</li>
</ul>
<strong>Input Not an Array Result:</strong>
<strong>False</strong>
Summary | Return a collection of properties from an array |
Returns | Updated collection of elements |
Remarks | If input is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
If property is not found, this will return an empty array | |
Parameters | |
input | Array of objects to search |
property | Property to match on |
Context
{
"array": [
{
"id": 1,
"name": "test1",
"type": {
"id": 5,
"name": "type1"
}
},
{
"id": 2,
"name": "test2",
"type": {
"id": 5,
"name": "type1",
"color": "blue"
}
},
{
"id": 3,
"name": "test2",
"type": {
"id": 6,
"name": "type2",
"color": "red"
}
},
{
"id": 4,
"name": "test3",
"type": {
"id": 7,
"name": "type3",
"color": "red"
}
}
],
"notArray": {
"id": 1
}
}
Usage
<strong>Direct Property:</strong>
{{#Enumerable.Select array "name"}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Select}}
<strong>Object Property:</strong>
{{#Enumerable.Select array "type"}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this.id}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Select}}
<strong>Nested Property:</strong>
{{#Enumerable.Select array "type.name"}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Select}}
<strong>Property Exists in Some Elements:</strong>
{{#Enumerable.Select array "type.color"}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Select}}
<strong>Property Doesen't Exist:</strong>
{{#Enumerable.Select array "doesnotexist"}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Select}}
<strong>Input Not an Array:</strong>
{{#Enumerable.Select notArray "id"}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Select}}
Returns
<strong>Direct Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test2</li>
<li>Value: test3</li>
</ul>
<strong>Object Property:</strong>
<strong>True</strong>
<ul>
<li>Value: 5</li>
<li>Value: 5</li>
<li>Value: 6</li>
<li>Value: 7</li>
</ul>
<strong>Nested Property:</strong>
<strong>True</strong>
<ul>
<li>Value: type1</li>
<li>Value: type1</li>
<li>Value: type2</li>
<li>Value: type3</li>
</ul>
<strong>Property Exists in Some Elements:</strong>
<strong>True</strong>
<ul>
<li>Value: blue</li>
<li>Value: red</li>
<li>Value: red</li>
</ul>
<strong>Property Doesen't Exist:</strong>
<strong>True</strong>
<ul>
</ul>
<strong>Input Not an Array:</strong>
<strong>False</strong>
Summary | Return a collection of elements from an array, skipping N elements |
Returns | Collection of elements, minus the ones that were skipped |
Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
Parameters | |
array | Array of objects to evaluate |
skipN | Number of elements to skip |
Context
{
"array": [
"one",
"two",
"three"
],
"badInput": {
"something": true
}
}
Usage
<strong>result:</strong>
{{#Enumerable.Skip array 2}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Skip}}
{{#Enumerable.Skip badInput 1}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Skip}}
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: three</li>
</ul>
<strong>False</strong>
Summary | Return a collection of N elements from an array |
Returns | Collection of N elements |
Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
Parameters | |
array | Array of objects to evaluate |
takeN | Number of elements to return |
Context
{
"array": [
"one",
"two",
"three"
],
"badInput": {
"something": true
}
}
Usage
<strong>result:</strong>
{{#Enumerable.Take array 2}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Take}}
{{#Enumerable.Take badInput 1}}
<strong>True</strong>
<ul>
{{#each this}}
<li>Value: {{this}}</li>
{{/each}}
</ul>
{{else}}
<strong>False</strong>
{{/Take}}
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: one</li>
<li>Value: two</li>
</ul>
<strong>False</strong>
You can’t perform that action at this time.