https://github.com/hexlet-components/js-pairs-data
https://github.com/hexlet-components/js-pairs-data
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet-components/js-pairs-data
- Owner: hexlet-components
- Created: 2016-06-04T16:47:20.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2025-12-10T15:11:47.000Z (7 months ago)
- Last Synced: 2025-12-10T23:37:53.336Z (7 months ago)
- Language: TypeScript
- Size: 2.09 MB
- Stars: 11
- Watchers: 8
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# js-pairs-data
[](https://github.com/hexlet-components/js-pairs-data/actions)
## Install
```sh
npm install @hexlet/pairs-data
```
## Usage example
```javascript
import {
l, isList, toString, cons, filter, head, tail
} from '@hexlet/pairs-data';
const numbers = l(3, 4, 5, 6, 7);
toString(numbers); // (3, 4, 5, 6, 7)
const first = head(numbers); // 3
const rest = tail(numbers);
toString(rest); // (4, 5, 6, 7)
isList(first); // false
isList(rest); // true
const newList = cons(8, rest);
toString(newList); // (8, 4, 5, 6, 7)
const filtered = filter((el) => el < 7, newList);
isList(filtered); // true
toString(filtered); // (4, 5, 6)
```
For more information, see the [Full Documentation](https://github.com/hexlet-components/js-pairs-data/tree/master/docs)
---
[](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=js-pairs-data)
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-data).
See most active contributors on [hexlet-friends](https://friends.hexlet.io/).