-
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
решение задач 2 модуля #2
Conversation
Добавляю преподавателя (@ufocoder) для код-ревью. |
Проверьте, пожалуйста, ваше решение, не все тесты прошли (PR не будет принят до тех пор, пока все добавленные задачи не будут решены). |
А, вот как работает синхронизация) |
@@ -5,5 +5,9 @@ | |||
* @returns {object} - returns the new object | |||
*/ | |||
export const pick = (obj, ...fields) => { | |||
const result = {}; | |||
|
|||
fields.map((item) => result[item] = obj[item]); |
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.
Не используйте map
, используйте forEach
или другой способ обхода массива
@@ -5,5 +5,9 @@ | |||
* @returns {object} - returns the new object | |||
*/ | |||
export const omit = (obj, ...fields) => { | |||
const newObj = obj; | |||
|
|||
fields.map((item) => delete newObj[item]); |
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.
Не используйте map
, используйте forEach
или другой способ обхода массива
Добавляю преподавателя (@ufocoder) для код-ревью. |
Разработаны:
сортировка с учетом регистра и алфавита (sortStrings)
функция получения отсортированного объекта по перечисленным ключам (pick)
функция получения отсортированного объекта по не вошедшим в перечисление ключам (omit)
вышло как-то топорно, но не смогла придумать ничего другого (createGetter)