# GetReplFn

**Kind:** Class

**Source:** [`packages/core/repl/native-functions/get-repl-fn.ts`](https://github.com/nestjs/nest/blob/master/packages/core/repl/native-functions/get-repl-fn.ts#L5)

**Part of:** [Core](subsystem-packages-core)

`GetReplFn` is a native REPL function implementation responsible for resolving and returning a function through its `action()` method. It participates in the core REPL native-function layer, allowing REPL expressions or commands to access callable behavior at runtime.

**Extends:** `ReplFunction`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `action` | `action(token: string | symbol | Function | Type<any>)` | `any` |

## Properties

| Property | Type |
|---|---|
| `fnDefinition` | `ReplFnDefinition` |

## Diagram

```mermaid
graph LR
  REPL[REPL Input] --> Resolver[Native Function Resolution]
  Resolver --> GetReplFn[GetReplFn]
  GetReplFn --> Action[action()]
  Action --> Function[Resolved Function]
```

## Usage

```ts
import { GetReplFn } from "./packages/core/repl/native-functions/get-repl-fn";

const getReplFn = new GetReplFn();

const resolvedFunction = getReplFn.action();

if (typeof resolvedFunction === "function") {
  const result = resolvedFunction();
  console.log(result);
}
```

## AI Coding Instructions

- Keep function-resolution logic inside `action()` so it remains consistent with other native REPL function implementations.
- Treat the `action()` return value as potentially dynamic; validate it before invoking it as a callable function.
- Follow the established native-function registration and naming conventions when integrating `GetReplFn` into the REPL runtime.
- Avoid adding REPL parsing concerns to this class; parsing and command dispatch should remain in the surrounding REPL infrastructure.
