js-linq
Install
npm install @hexlet/linq
Usage example
import HexletLinq from '@hexlet/linq';
const cars = [
{ brand: 'bmw', model: 'm5', year: 2014 },
{ brand: 'bmw', model: 'm4', year: 2013 },
{ brand: 'kia', model: 'sorento', year: 2014 },
{ brand: 'kia', model: 'rio', year: 2010 },
{ brand: 'kia', model: 'sportage', year: 2012 },
];
const coll = HexletLinq.from(cars);
const result = coll.orderBy(car => car.year, 'desc')
.where(car => car.brand === 'kia')
.select(car => car.model);
result.toArray();
// ['sorento', 'sportage', 'rio']
For more information, see the Full Documentation
This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet (in Russian).