Mercurial > hg > ugly-duckling
view src/app/services/feature-extraction/FeatureReducers.ts @ 316:98490d0ceb77
Lint.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Fri, 12 May 2017 17:14:59 +0100 |
parents | dc415a620b15 |
children | c39df81c4dae |
line wrap: on
line source
/** * Created by lucast on 26/04/2017. */ import {StreamingResponse} from 'piper/StreamingService'; export const arrayReducer = <T>(acc: T[], val: T[]): T[] => { const len = val.length; for (let i = 0; i < len; ++i) { acc.push(val[i]); } return acc; }; export const typedArrayReducer = (acc: Float32Array, val: Float32Array): Float32Array => { return Float32Array.of(...acc, ...val); }; const inPlaceTypedArrayReducer = (acc: Float32Array, val: Float32Array, i: number): Float32Array => { acc.set(val, i); return acc; }; export const streamingResponseReducer = (acc: StreamingResponse, val: StreamingResponse): StreamingResponse => { acc.progress = val.progress; if (val.configuration) { acc.configuration = val.configuration; } arrayReducer(acc.features, val.features); return acc; };