Skip to content

Conversation

@Seneckiy
Copy link
Owner

@Seneckiy Seneckiy commented Jun 2, 2020

No description provided.

}
else
return false
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Всё эту функцию лучше свернуть в одну строчку :)

return value.match(/^[+]?\d+(\.\d+)?$/) && parseInt(value) < 15 && parseInt(value) > 0;

И для приведения к числу лучше parseInt использовать, в некоторых кейсах он отрабатывает лучше

return false
}
else
return false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут тоже странно

if (isString(sampleActivity) && isValid(sampleActivity)) {
   return ...
} else {
  return false;
}

а за такое любой линтер начнёт матом ругаться

else 
    return ...

я знаю что в питоне это ок, а у нас так не принято

let firstLetters = [];
for (member of members){
if(isString(member)){
firstLetters.push(member.split(' ').join('').toUpperCase()[0])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

К символам строки тоже можно через квадратные скобки обращаться
member[0].toUpperCase() хватило бы здесь

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а чтобы избавиться от пробелов в начале строки можно метод trim() использовать

// remove line with error and write your code here
function convertHoursToSeconds(hours) {
return Math.floor(hours * 60 * 60);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Думаю, лишняя функция. Хватило бы одной константы

return {
'turns': turns,
'seconds': seconds
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

здесь можно было просто написать:

return { turns, seconds };

calculateDepth = function calculateDepth(arr){
return 1 + (arr instanceof Array ? arr.reduce(function(max, item) {
return Math.max(max, calculateDepth(item));
}, 0) : -1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Охох, тернарки иногда не стоит использовать :)
здесь лучше распить через if {} else {}

// remove line with error and write your code here
let str = '';
for (ind in this.arr){
if (ind == 0){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не лучшая идея проверять это условие каждую итерацию.
Я бы сначало через map() метод добавил скобки к элементам, а после соединил через .join('~~')

let index = array.indexOf(elem);
array.splice(index, 1);
let newArray = controlSequences[elem](array, index);
return transform(newArray)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

О_О слишком сложно, рекурсия здесь точно не нужна

}
}
catch (e) {
throw (e)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw не должен вызываться в блоке catch
наоборот его вызывают в блоке try, чтобы попасть в catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants