Skip to content

Commit

Permalink
perf: reduce stack for alias functions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrbradley committed May 23, 2020
1 parent 1ab6dd1 commit bc00a89
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/iterable-fns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,7 @@ export function count<T>(source: Iterable<T>): number {
* @example
* length(init(5)) // Returns: 5
*/
export function length<T>(source: Iterable<T>): number {
return count(source)
}
export const length = count

/**
* Yields an iterable ordered by the selected key.
Expand Down Expand Up @@ -843,7 +841,7 @@ export class ChainableIterable<T> implements Iterable<T> {
* // Returns: [0, 1, 2]
*/
toArray(): T[] {
return toArray(this.source)
return Array.from(this.source)
}

/**
Expand Down

0 comments on commit bc00a89

Please sign in to comment.