-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
новое решение sortStrings #3
Conversation
Добавляю преподавателя (@dosandk) для код-ревью. |
Решение было обновлено, посмотрим что скажет @dosandk |
@@ -4,5 +4,16 @@ | |||
* @returns {function} - function-getter which allow get value from object by set path | |||
*/ | |||
export function createGetter(path) { | |||
|
|||
const partsArray = path.split("."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good 👍 лайк за использование замыкания
let value = {...obj}; | ||
for (let i = 0; i < partsArray.length; i++) { | ||
if (typeof value[partsArray[i]] === 'undefined') { | ||
return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нельзя напрямую возвращать undefined
@@ -4,5 +4,6 @@ | |||
* @returns {*[]} - the new array with uniq values | |||
*/ | |||
export function uniq(arr) { | |||
|
|||
const uniq = new Set(arr); | |||
return Array.from(uniq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
подумайте какие есть преимущества у Array.from
по сравнению с спред-синтаксисом:
return [...new Set(arr)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
знаю только, что для TypeScript нежелательное использования спред синтаксиса с Set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elenakochegina почему нежелательно в TypeScript использовать спред с Set
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавляю преподавателя (@dosandk) для код-ревью. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 good
No description provided.