import { Meta } from '@storybook/addon-docs/blocks'

<Meta title='@dxtmisha/en/nitro-basic/Functions/getInject - Get Injected Value'/>

# `getInject`

A utility function that safely reads an injected value by name from the current Vue component instance. If there is no active component instance or the value is not provided, it returns `undefined`.

**Parameters:**
- `name: string` — The injection key name.

**Returns:**
`T | undefined` — The injected value if it exists, otherwise `undefined`.

```typescript
import { provide } from 'vue'
import { getInject } from '@dxtmisha/nitro-basic'

provide('theme', 'dark')

// Returns 'dark'
const theme = getInject<string>('theme')

// Returns undefined when the key is missing
const language = getInject<string>('language')
```

