Skip to content

Commit

Permalink
perf(transducers): update string version of palindrome()
Browse files Browse the repository at this point in the history
- avoid char-wise iteration of original input
  • Loading branch information
postspectacular committed Jan 13, 2020
1 parent 546bf9f commit 315cbf8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/transducers/src/iter/palindrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function palindrome<T>(x: T[]): T[];
export function palindrome<T>(x: Iterable<T>): Iterable<T>;
export function palindrome(x: any): any {
return isString(x)
? str("", concat(x, reverse(x)))
? str("", concat([x], reverse(x)))
: isArray(x)
? x.concat(x.slice().reverse())
: ((x = ensureArray(x)), concat(x, reverse(x)));
Expand Down

0 comments on commit 315cbf8

Please sign in to comment.