[](https://github.com/hexlet-components/js-pairs/actions)
npm install @hexlet/pairs
``sh`
npm install @hexlet/pairs
`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)
`
Full type definitions ship with the package:
`ts
import { cons, car } from '@hexlet/pairs'
import type { Pair } from '@hexlet/pairs'
const pair: Pair
const left = car(pair) // type: number
`
For more information, see the Full Documentation
- npm test — run Vitestnpm run lint
- — ESLint (JS + TS)npm run typecheck
- — strict TypeScript diagnosticsnpm run build
- — emit ESM artifacts to dist/`
---

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.