-
Notifications
You must be signed in to change notification settings - Fork 24
Сучков Георгий #16
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
base: master
Are you sure you want to change the base?
Сучков Георгий #16
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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], | ||
| ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Я понял, чутка недоделал
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. я если что изменил название переменной, чтобы сделать коммит There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }); | ||
|
|
||
| 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 }; | ||


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.
задача засчитана на 2 балла