{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "reference-app-core-core-filter",
  "title": "Filter collection",
  "section": "Library asset reference",
  "description": "Filter collection Selects items whose JavaScript predicate is truthy, preserving the original item values and order. Unlike Map collection, this asset has no Execute or next control socket. Sockets and configuration - items (array, required",
  "kind": "node",
  "url": "/wiki/reference-app-core-core-filter/",
  "markdown": "/wiki/reference-app-core-core-filter/index.md",
  "json": "/wiki/reference-app-core-core-filter/index.json",
  "headings": [
    {
      "id": "sockets-and-configuration",
      "title": "Sockets and configuration",
      "depth": 2
    },
    {
      "id": "example",
      "title": "Example",
      "depth": 2
    },
    {
      "id": "predicate-and-execution-details",
      "title": "Predicate and execution details",
      "depth": 2
    },
    {
      "id": "catalog-identity",
      "title": "Catalog identity",
      "depth": 2
    },
    {
      "id": "inputs",
      "title": "Inputs",
      "depth": 2
    },
    {
      "id": "outputs",
      "title": "Outputs",
      "depth": 2
    },
    {
      "id": "configuration-schema",
      "title": "Configuration schema",
      "depth": 2
    },
    {
      "id": "source-and-installed-versions",
      "title": "Source and installed versions",
      "depth": 2
    }
  ],
  "sources": [
    "../OpenNodeFlow-Library/work/catalog-all.mjs",
    "../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs",
    "../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs",
    "shared/seed.ts",
    "shared/storage-library.ts",
    "shared/variable-library.ts",
    "shared/control-flow.ts",
    "shared/remote-routes.ts",
    "server/runtime-library.ts",
    "shared/error-library.ts",
    "shared/storage-model.ts",
    "shared/builtin-documentation.ts"
  ],
  "family": "app-core",
  "contract": {
    "key": "app.core.core.filter",
    "slug": "app-core-core-filter",
    "name": "Filter collection",
    "kind": "node",
    "family": "app-core",
    "packId": null,
    "category": "Collections",
    "description": "",
    "inputs": [
      {
        "id": "items",
        "name": "Items",
        "type": "array",
        "typeName": "Array",
        "required": true
      }
    ],
    "outputs": [
      {
        "id": "items",
        "name": "Items",
        "type": "array",
        "typeName": "Array",
        "required": false
      },
      {
        "id": "count",
        "name": "Count",
        "type": "number",
        "typeName": "Number",
        "required": false
      }
    ],
    "configSchema": {
      "type": "object",
      "properties": {
        "expression": {
          "type": "string",
          "title": "Predicate",
          "default": "item != null"
        }
      }
    },
    "documentation": "# Filter collection\n\nSelects items whose JavaScript predicate is truthy, preserving the original item values and order. Unlike Map collection, this asset has no Execute or next control socket.\n\n## Sockets and configuration\n- **items** (array, required): source collection.\n- **items** (array): accepted source items. **count** (number): accepted length.\n- **expression** (string): new-instance default `item != null`, removing nulls. If configuration is absent or empty, the code instead falls back to `true`, retaining everything.\n\n## Example\nFor items `[{\"value\":5},{\"value\":12}]`, use `item.value > 10`. Output is `[{\"value\":12}]` with count 1. The index parameter is the source position; filtering does not rewrite or transform accepted values.\n\n## Predicate and execution details\nThe expression is compiled with new Function(item, index); it cannot close over node-local inputs/config/context. It uses JavaScript Array.filter synchronously. Do not return a Promise: promises are truthy objects and are not awaited, so an asynchronous predicate would select items incorrectly.\n\nA data dependency determines execution readiness; this asset cannot be gated directly by a control wire without publishing a customized version with a control input. Missing required input fails validation; bad predicate syntax/runtime errors fail execution. An empty source array yields count 0. The shipped wrapper has no secret/state/network calls, but expressions are trusted code with JavaScript globals. Prefer pure predicates because retries can repeat any effects an expression introduces.",
    "tags": [
      "builtin",
      "node"
    ],
    "source": "app-builtin-catalog"
  }
}
