Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions topic-5/task-1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@


function breadcrumbCalculate(setter){
for (let i = 0; i < 1e7; i++) {
i++;
setter(i);
}
let i = 0
const timer = setInterval(() => {
if( i === 1e7) {
clearInterval(timer);
}
else {
i++;
setter(i);
}
});
}

module.exports.breadcrumbCalculate = breadcrumbCalculate;

Choose a reason for hiding this comment

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

задача засчитана на 2 балла

37 changes: 34 additions & 3 deletions topic-5/task-2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,45 @@
Класс должен иметь поля: code, type, value, name.
type - наименование группы по МСС, а value сумма затраченная на приобритение данного продукта.

Как строить класс и как экспортиоровать функцию resolveBudget, дело ваше, полная свобода.
Как строить класс и как экспортиоровать функцию resolveBudget, дело ваше, полная свобода.
*/
import { stringOfPurchases } from "./list-items";

const CodesTypes = {
5411: "Продукты",
5732: "Электроника",
5812: "Составная еда",
5993: "Никотиновый глицерин",
5039: "Строительные материалы",
5172: "Комплектующие авто",
5651: "Одежда"
}

function resolveBudget(string){

Choose a reason for hiding this comment

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

зачем аргумент string?


if (typeof(string) !== 'string'){
throw new Error('Не то значение')
}

const result = stringOfPurchases.split(', ').map(x => {
const array = x.split(' ');
return new Purchase(
array.slice(0, array.length - 2).join(' '),
array[array.length - 2],
array[array.length - 1],
);

Choose a reason for hiding this comment

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

image

парсинг некорректный

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
Author

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

image
парсинг работает плохо

});

return result;
}

class Purchase{
constructor(value, type, code, name) {
this.code = code;
this.type = CodesTypes[type];
this.value = value;
this.name = name;
}
}

module.exports.resolveBudget = resolveBudget;
const _resolveBudget = resolveBudget;
export { _resolveBudget as resolveBudget };