Skip to content

Conversation

@Uliana1997
Copy link

No description provided.

@honest-hrundel honest-hrundel changed the title First Квашнина Ульяна Nov 2, 2016
@honest-hrundel
Copy link

🍅 Пройдено тестов 10 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 10 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 14 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 14 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 14 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 14 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 14 из 15

@honest-hrundel
Copy link

🍅 Пройдено тестов 10 из 15

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

@onufrienko
Copy link

Привет! :) Я посмотрю твой пр сегодня вечером либо завтра, не теряй меня, если что.

@Uliana1997
Copy link
Author

Хорошо)

Отправлено с iPhone

3 нояб. 2016 г., в 11:29, Ekaterina Onufrienko notifications@github.com написал(а):

Привет! :) Я посмотрю твой пр сегодня вечером либо завтра, не теряй меня, если что.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

lego.js Outdated
exports.isStar = false;

var priority = {
'filterIn': 1,

Choose a reason for hiding this comment

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

Кавычки не нужны

lego.js Outdated
exports.query = function (collection) {
return collection;
var newCollection = copyCollections(collection);
var fields = Array.prototype.slice.call(arguments).slice(1);

Choose a reason for hiding this comment

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

fields или все же functions?

return collection;
var newCollection = copyCollections(collection);
var fields = Array.prototype.slice.call(arguments).slice(1);
function compare(one, another) {

Choose a reason for hiding this comment

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

Эту функцию можно сильно сократить, возвращая, например, x - y

lego.js Outdated
* Выбор полей
* @params {...String}
*/
function copyCollections(collection) {

Choose a reason for hiding this comment

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

По названию можно подумать, что метод копирует несколько коллекций

*/
exports.sortBy = function (property, order) {
console.info(property, order);
return function sortBy(collection) {

Choose a reason for hiding this comment

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

у тебя получилась достаточно большая функция сортировки, ее можно сделать проще

lego.js Outdated
collection.sort(function (one, another) {
var x = one.name;
var y = another.name;
if (x < y) {

Choose a reason for hiding this comment

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

Копипаст

};

exports.filterIn = function (property, values) {
return function filterIn(collection) {

Choose a reason for hiding this comment

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

попробуй метод filter

@onufrienko
Copy link

🍅

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

@Uliana1997
Copy link
Author

🍏

@onufrienko
Copy link

🚀

@honest-hrundel honest-hrundel assigned evilj0e and unassigned onufrienko Nov 8, 2016
return newCollection;
};

/**
Copy link
Member

Choose a reason for hiding this comment

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

Зачем поудаляла все jsdoc?

Copy link
Author

Choose a reason for hiding this comment

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

мне с ними было неудобно, тут маленький код и так было понятно( мне их вернуть назад??

Copy link
Member

Choose a reason for hiding this comment

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

Их же можно сворачивать в IDE :) В данном случае, да маленький, но стоит привыкать с ним работать. Писать *doc – хороший тон.

*/
exports.isStar = false;

var priority = {
Copy link
Member

Choose a reason for hiding this comment

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

Стоит написать комментарий, что значат эти цифры – больше число выполнится "быстрее" или в последнюю очередь


return x - y;
}
functions.sort(compare);
Copy link
Member

Choose a reason for hiding this comment

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

Не старайся усложнять там, где всё можно сделать проще. Когда функция сортировки достаточно простая, не стоит выносить её в отдельную функцию. К тому же её можно написать сильно короче и проще:

functions.sort(function (a, b) {
    return priority[a.name] - priority[b.name];
});

lego.js Outdated
return x - y;
}
functions.sort(compare);
functions.forEach(function (func) {
Copy link
Member

Choose a reason for hiding this comment

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

func стоит переименовать. Нейминг в данном случае ничего не говорит.

lego.js Outdated
console.info(property, values);
return function select(collection) {
var result = [];
collection.forEach(function (friend) {
Copy link
Member

Choose a reason for hiding this comment

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

Смотри, ты здесь создаёшь массив, бегаешь в цикле, пушишь в результирующий массив. Всё это делает Array.reduce() (MDN), только более красиво.
Посмотри в его сторону. Это то, что тебе здесь нужно.

*/
exports.sortBy = function (property, order) {
console.info(property, order);
return function sortBy(collection) {
Copy link
Member

Choose a reason for hiding this comment

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

Ульяна, у тебя есть идеи как оптимизировать эту функцию?

Copy link
Author

Choose a reason for hiding this comment

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

есть, сейчас я исправлю всё

Copy link
Member

Choose a reason for hiding this comment

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

👍
Супер! Спасибо

@evilj0e
Copy link
Member

evilj0e commented Nov 9, 2016

🍅

@honest-hrundel
Copy link

🍅 Не пройден линтинг или базовые тесты

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

@Uliana1997
Copy link
Author

🍏

@Uliana1997
Copy link
Author

Только я не знаю как заменить reduce, то что вы описываете делает вроде map, то есть мы создаем новый массив вызывая функцию в нем
А reduce применяет функцию и сводит к одному значению, или я не так что то понимаю??

@evilj0e
Copy link
Member

evilj0e commented Nov 10, 2016

Итоговым значением может же быть и массив. Вот, прочитай, тут про reduce.

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

@Uliana1997
Copy link
Author

🍏

@Uliana1997
Copy link
Author

исправила все замечания

@evilj0e
Copy link
Member

evilj0e commented Nov 11, 2016

Ульяна, не все комментарии учтены.
🍅

@honest-hrundel
Copy link

🍅 Не пройден линтинг или базовые тесты

@honest-hrundel
Copy link

🍏 Пройдено тестов 15 из 15

@Uliana1997
Copy link
Author

🍏


return;
if (order === 'asc') {
collection.sort(compare);
Copy link
Member

Choose a reason for hiding this comment

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

Метод sort – не чистая функция. Только что ты мутировала коллекцию. Требования задания не учтены.

@evilj0e
Copy link
Member

evilj0e commented Nov 15, 2016

🍅

@evilj0e
Copy link
Member

evilj0e commented Nov 24, 2016

⬆️ @Uliana1997

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