refactor snippet reducing the amount of lines
This commit is contained in:
@ -7,11 +7,8 @@ const permuteAll = (input) => {
|
|||||||
const result = [];
|
const result = [];
|
||||||
let inputState = input;
|
let inputState = input;
|
||||||
|
|
||||||
if (typeof input === 'string') {
|
if (typeof input === 'string') inputState = input.split('')
|
||||||
inputState = input.split('');
|
if (typeof input === 'number') inputState = (input).toString().split('');
|
||||||
} else if (typeof input === 'number') {
|
|
||||||
inputState = (input).toString().split('');
|
|
||||||
}
|
|
||||||
|
|
||||||
const permute = (arr, m = []) => {
|
const permute = (arr, m = []) => {
|
||||||
if (arr.length === 0) {
|
if (arr.length === 0) {
|
||||||
|
|||||||
@ -2,11 +2,8 @@ const permuteAll = (input) => {
|
|||||||
const result = [];
|
const result = [];
|
||||||
let inputState = input;
|
let inputState = input;
|
||||||
|
|
||||||
if (typeof input === 'string') {
|
if (typeof input === 'string') inputState = input.split('')
|
||||||
inputState = input.split('');
|
if (typeof input === 'number') inputState = (input).toString().split('');
|
||||||
} else if (typeof input === 'number') {
|
|
||||||
inputState = (input).toString().split('');
|
|
||||||
}
|
|
||||||
|
|
||||||
const permute = (arr, m = []) => {
|
const permute = (arr, m = []) => {
|
||||||
if (arr.length === 0) {
|
if (arr.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user