Skip to content

Commit

Permalink
fix(toArray): do not mutate array per subscription (#3335)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and benlesh committed Mar 8, 2018
1 parent 7d900a1 commit e2cd3a2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/operators/toArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { reduce } from './reduce';
import { OperatorFunction } from '../interfaces';

function toArrayReducer<T>(arr: T[], item: T, index: number) {
if (index === 0) {
return [item];
}
arr.push(item);
return arr;
}
Expand Down

0 comments on commit e2cd3a2

Please sign in to comment.