ect-ng-linq-js
v1.21.6
Published
JavaScript-first LINQ-style utilities inspired by ECT NgLinq
Maintainers
Readme
EctNgLinq JS
ect-ng-linq-js brings LINQ-style operations to arrays in a JavaScript-first package, suitable for Vanilla JS and React.
Build
npm run build:ect-ng-linq-jsVanilla JS
import { createNgLinq } from 'ect-ng-linq-js';
const records = createNgLinq();
records.addRange([
{ id: 1, amount: 120 },
{ id: 2, amount: 80 },
{ id: 3, amount: 220 }
]);
const highValue = records.where(r => r.amount >= 100);
console.log(highValue.count()); // 2
console.log(records.sum(r => r.amount)); // 420React
import { createNgLinq } from 'ect-ng-linq-js';
export function Totals() {
const values = createNgLinq<number>();
values.addRange([5, 15, 25, 35]);
const total = values.sum(v => v);
const average = values.average(v => v) as number;
return <div>Total: {total}, Average: {average}</div>;
}API highlights
- Creation:
createNgLinq<T>(),EctNgLinqServiceJs - Filtering:
where,any,all,first,last - Ordering:
orderBy,orderByDescending - Aggregates:
sum,average,min,max,count - Set/group operations:
distinct,groupBy - Paging helpers:
skipAndTake,takeTop,takeFirst,takeLast
Dependencies
- No framework dependency at runtime
Further help
- https://angular-grid.net/
Licence
The licence agreement for this paid component can be found here:
- https://angular-grid.net/assets/licence/licence_agreement.txt
