@echelon-framework/functions-core
v0.7.1
Published
Echelon functions-core — wbudowane PureFunctions: searchRows, paginate, totalPages, count, pickById, mergeRow, deleteRow.
Readme
@echelon-framework/functions-core
Built-in pure functions for computed datasources in Echelon framework.
Part of the Echelon Framework — Angular-based, config-driven dashboard & low-code platform.
Installation
npm install @echelon-framework/functions-coreUsage
import { coreFunctions } from '@echelon-framework/functions-core';
provideEchelon({
functions: [...coreFunctions, ...myCustomFunctions],
});Available functions
| Function | Inputs | Output | Description |
| ----------- | -------------------- | ------ | ------------------------- |
| count | array | number | Array length |
| filter | array, predicate | array | Filter items |
| search | array, query, fields | array | Text search across fields |
| paginate | array, page, size | array | Slice for pagination |
| pickById | array, id, idField | object | Find by primary key |
| mergeRow | array, item, idField | array | Upsert item in array |
| formatPln | number | string | Format as PLN currency |
| addLp | array | array | Add sequential lp field |
| sum | array, field | number | Sum numeric field |
Custom functions
import { PureFunction } from '@echelon-framework/runtime';
@PureFunction({
description: 'Compute dealer rate from spot + margin',
inputs: [
{ name: 'spot', type: '{bid,ask}' },
{ name: 'marginPips', type: 'number' },
],
output: { type: 'number' },
})
export class ComputeDealerRate {
static fn(spot: { bid: number; ask: number }, marginPips: number): number {
return +(spot.ask + marginPips * 0.0001).toFixed(5);
}
}License
BUSL-1.1
