https://github.com/hexlet-components/js-pairs
https://github.com/hexlet-components/js-pairs
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet-components/js-pairs
- Owner: hexlet-components
- Created: 2016-04-25T10:25:02.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2025-11-24T09:36:39.000Z (7 months ago)
- Last Synced: 2025-11-27T22:08:08.660Z (7 months ago)
- Language: JavaScript
- Size: 1.04 MB
- Stars: 36
- Watchers: 10
- Forks: 21
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# js-pairs
[](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 = 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` — run Vitest
- `npm run lint` — ESLint (JS + TS)
- `npm run typecheck` — strict TypeScript diagnostics
- `npm run build` — emit ESM artifacts to `dist/`
---
[](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).