js-pairs

Install
npm install @hexlet/pairs
Usage example
import {
cons, car, cdr, toString, isPair,
} from '@hexlet/pairs';
const pair = cons(3, 5);
isPair(pair);
car(pair);
cdr(pair);
toString(pair);
TypeScript
Full type definitions ship with the package:
import { cons, car } from '@hexlet/pairs'
import type { Pair } from '@hexlet/pairs'
const pair: Pair<number, string> = cons(1, 'hexlet')
const left = car(pair)
For more information, see the Full Documentation
Development
npm test — run Vitest
npm run lint — ESLint (JS + TS)
npm run typecheck — strict TypeScript diagnostics
npm 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.