Skip to content

Commit

Permalink
fix(toArray): do not mutate array per subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Feb 21, 2018
1 parent c7e33e4 commit 72ded7b
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 72ded7b

Please sign in to comment.