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

<Meta title='@dxtmisha/en/functional-basic/Functions/getFirst - Get the first element'/>

# `getFirst`

Returns the first element of an array or object. If the value is a primitive, returns the value itself.

**Parameters:**
- `value: T | T[] | Record<string, T>` — input value.

**Returns:**
`T | undefined` — the first element of the array or object, or the value itself.

```typescript
import { getFirst } from '@dxtmisha/functional-basic'

console.log(getFirst([1, 2, 3])) // 1
console.log(getFirst({ a: 1, b: 2 })) // 1
console.log(getFirst('string')) // 'string'
```
