# @hexlet/pairs

> [![github action status](https://github.com/hexlet-components/js-pairs/workflows/Node%20CI/badge.svg)](https://github.com/hexlet-components/js-pairs/actions)

Latest version **2.0.1** (published 2025-12-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install @hexlet/pairs
pnpm add @hexlet/pairs
yarn add @hexlet/pairs
bun add @hexlet/pairs
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-12-09 |
| First published | 2019-06-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.0 |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Kirill Mokevnin |
| Maintainers | feycot, mokevnin, corsicanec82 |

## Links

- npm: https://www.npmjs.com/package/@hexlet/pairs
- Repository: https://github.com/hexlet-components/js-pairs
- Homepage: https://github.com/hexlet-components/js-pairs#readme
- Issues: https://github.com/hexlet-components/js-pairs/issues
- npm.io page: https://npm.io/package/@hexlet/pairs

## Recent versions

- 2.0.1 (latest) — 2025-12-09
- 2.0.0 — 2025-12-09
- 1.1.1 — 2021-01-19
- 1.1.0 — 2020-09-15
- 1.0.15 — 2020-05-24
- 1.0.14 — 2020-04-03
- 1.0.13 — 2020-04-02
- 1.0.11 — 2020-02-28
- 1.0.10 — 2019-06-28
- 1.0.9 — 2019-06-19

## README

# js-pairs

[![github action status](https://github.com/hexlet-components/js-pairs/workflows/Node%20CI/badge.svg)](https://github.com/hexlet-components/js-pairs/actions)

## Install

```sh
npm install @hexlet/pairs
```

## Usage example

```javascript
import {
  cons, car, cdr, toString, isPair,
} from '@hexlet/pairs';

const pair = cons(3, 5);

isPair(pair); // true

car(pair); // 3
cdr(pair); // 5

toString(pair); // (3, 5)
```

### TypeScript

Full type definitions ship with the package:

```ts
import { cons, car } from '@hexlet/pairs'
import type { Pair } from '@hexlet/pairs'

const pair: Pair<number, string> = cons(1, 'hexlet')
const left = car(pair) // type: number
```

For more information, see the [Full Documentation](https://github.com/hexlet-components/js-pairs/tree/master/docs)

## Development

- `npm test` &mdash; run Vitest
- `npm run lint` &mdash; ESLint (JS + TS)
- `npm run typecheck` &mdash; strict TypeScript diagnostics
- `npm run build` &mdash; emit ESM artifacts to `dist/`

---

[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=js-pairs)

This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=js-pairs).

---
_Source: https://npm.io/package/@hexlet/pairs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
