Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
fix(reverse): Use isArray-module
Browse files Browse the repository at this point in the history
  • Loading branch information
adambrgmn committed Jan 16, 2018
1 parent e3b6b59 commit 24cb477
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/reverse.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import reduceRight from './reduceRight';
import pipe from './pipe';
import isArray from './isArray';

const reverseArray = reduceRight((a, e) => a.concat(e), []);
const reverseString = pipe(s => s.split(''), reverseArray, a => a.join(''));

export default arr => {
if (Array.isArray(arr)) return reverseArray(arr);
if (isArray(arr)) return reverseArray(arr);
return reverseString(arr);
};

0 comments on commit 24cb477

Please sign in to comment.