@ldrick/trade-indicators
Version:
Trade Indicators
16 lines (15 loc) • 677 B
JavaScript
import { either as E, function as F, readonlyRecord as RR } from 'fp-ts';
import * as array from './array.js';
/**
* Safely convert `RR.ReadonlyRecord<string, RNEA.ReadonlyNonEmptyArray<number>>>`
* to `RR.ReadonlyRecord<string, RNEA.ReadonlyNonEmptyArray<Big>>>`.
* @internal
*/
export const toBig = (record) => F.pipe(record, RR.traverse(E.Applicative)(array.toBig));
/**
* Validates if every Array in Record has the required size.
* @internal
*/
export const validateRequiredSize = (required) => (record) => F.pipe(record,
// Not so cool, type inference for "a" is not working as expected
RR.traverse(E.Applicative)((a) => array.validateRequiredSize(required)(a)));