{
  "id": "@typed/fx/Sink#filterMap",
  "canonicalId": "@typed/fx/Sink#filterMap",
  "symbol": {
    "id": "@typed/fx/Sink#filterMap",
    "packageName": "@typed/fx",
    "moduleName": "Sink",
    "exportName": "filterMap",
    "kind": "function",
    "signatures": [
      "export declare function filterMap<A, E, R, B>(sink: Sink<A, E, R>, f: (b: B) => Option.Option<A>): Sink<B, E, R>;"
    ],
    "summary": "Filters and transforms values before they reach the sink using a function that returns an `Option`.",
    "sections": {
      "Why": "Selection and transformation happen at the consumer boundary without constructing another Fx.",
      "Ownership and lifetime": "Inputs are inspected synchronously in arrival order. `Some` invokes the wrapped sink once;\n`None` invokes it zero times. The adapter acquires no resources and failures pass through."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect, Option } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nimport { Fx } from \"@typed/fx\"\n\nconst program = Effect.gen(function* () {\n  const sink = Sink.make(\n    (cause) => Effect.void,\n    (value: number) => Effect.sync(() => console.log(\"Even:\", value))\n  )\n\n  // Only pass through even numbers\n  const filtered = Sink.filterMap(sink, (n: number) =>\n    n % 2 === 0 ? Option.some(n) : Option.none()\n  )\n\n  yield* Fx.fromIterable([1, 2, 3, 4, 5]).run(filtered)\n  // Output: \"Even: 2\", \"Even: 4\"\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Sink/combinators.ts",
      "line": 229
    },
    "since": "1.0.0",
    "category": "Selecting inputs"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Sink#filterMap",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Sink",
    "consumerSpecifier": "@typed/fx/Sink",
    "exportName": "filterMap",
    "qualifiedName": "filterMap",
    "declarationKey": "declaration:5b8a80ed852826d68c732e94",
    "family": "function",
    "signatures": [
      "export declare function filterMap<A, E, R, B>(sink: Sink<A, E, R>, f: (b: B) => Option.Option<A>): Sink<B, E, R>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 229,
          "column": 1
        },
        "end": {
          "line": 234,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/fx#Sink.filterMap"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:5b8a80ed852826d68c732e94",
    "name": "filterMap",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function filterMap<A, E, R, B>(sink: Sink<A, E, R>, f: (b: B) => Option.Option<A>): Sink<B, E, R>;"
        ],
        "typeParameters": [
          "A",
          "E",
          "R",
          "B"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Sink/combinators.ts",
            "start": {
              "line": 229,
              "column": 1
            },
            "end": {
              "line": 234,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function filterMap<A, E, R, B>(sink: Sink<A, E, R>, f: (b: B) => Option.Option<A>): Sink<B, E, R>;"
    ],
    "typeParameters": [
      "A",
      "E",
      "R",
      "B"
    ],
    "summary": "Filters and transforms values before they reach the sink using a function that returns an `Option`.",
    "sections": {
      "Why": "Selection and transformation happen at the consumer boundary without constructing another Fx.",
      "Ownership and lifetime": "Inputs are inspected synchronously in arrival order. `Some` invokes the wrapped sink once;\n`None` invokes it zero times. The adapter acquires no resources and failures pass through."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect, Option } from \"effect\"\nimport * as Sink from \"@typed/fx/Sink\"\nimport { Fx } from \"@typed/fx\"\n\nconst program = Effect.gen(function* () {\n  const sink = Sink.make(\n    (cause) => Effect.void,\n    (value: number) => Effect.sync(() => console.log(\"Even:\", value))\n  )\n\n  // Only pass through even numbers\n  const filtered = Sink.filterMap(sink, (n: number) =>\n    n % 2 === 0 ? Option.some(n) : Option.none()\n  )\n\n  yield* Fx.fromIterable([1, 2, 3, 4, 5]).run(filtered)\n  // Output: \"Even: 2\", \"Even: 4\"\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Sink/combinators.ts",
        "start": {
          "line": 229,
          "column": 1
        },
        "end": {
          "line": 234,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Selecting inputs"
  }
}
