diff --git a/snippets/permuteAll.md b/snippets/permuteAll.md index d6555210b..63cde20da 100644 --- a/snippets/permuteAll.md +++ b/snippets/permuteAll.md @@ -7,11 +7,8 @@ const permuteAll = (input) => { const result = []; let inputState = input; - if (typeof input === 'string') { - inputState = input.split(''); - } else if (typeof input === 'number') { - inputState = (input).toString().split(''); - } + if (typeof input === 'string') inputState = input.split('') + if (typeof input === 'number') inputState = (input).toString().split(''); const permute = (arr, m = []) => { if (arr.length === 0) { diff --git a/test/permuteAll/permuteAll.js b/test/permuteAll/permuteAll.js index f005c1bd8..672c7a094 100644 --- a/test/permuteAll/permuteAll.js +++ b/test/permuteAll/permuteAll.js @@ -2,11 +2,8 @@ const permuteAll = (input) => { const result = []; let inputState = input; -if (typeof input === 'string') { -inputState = input.split(''); -} else if (typeof input === 'number') { -inputState = (input).toString().split(''); -} +if (typeof input === 'string') inputState = input.split('') +if (typeof input === 'number') inputState = (input).toString().split(''); const permute = (arr, m = []) => { if (arr.length === 0) {