79474955

Date: 2025-02-28 08:54:17
Score: 0.5
Natty:
Report link

try something like :

manipulate the data manually using plain javascript inside switchMap and return it with rxjs.of

arrayDataObservable$.pipe(
    bufferTime(1000),
    switchMap((bufferd) => {
        // manually defined data manipulation
        const groupedObj = Object.groupBy(bufferedVal, el => Object.values(el).join(''));
        const filteredDistinctValues = Object.values(groupedObj).map(el => el[0]);
        // Object.groupBy doesnt respect the original array sort order, filtering from 
        const distinctValues = bufferdVal.filter(el => filteredDistinctValues.includes(el))
        return of(...distinctValues)
    }),
)

the data manipulation function could be optimized, just use mine as reference

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: aii-yin